100 lines
1.9 KiB
Go
100 lines
1.9 KiB
Go
|
// Code generated by sqlc. DO NOT EDIT.
|
||
|
// versions:
|
||
|
// sqlc v1.26.0
|
||
|
// source: calls.sql
|
||
|
|
||
|
package database
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/jackc/pgx/v5/pgtype"
|
||
|
)
|
||
|
|
||
|
const addCall = `-- name: AddCall :one
|
||
|
INSERT INTO calls (
|
||
|
id,
|
||
|
submitter,
|
||
|
system,
|
||
|
talkgroup,
|
||
|
date,
|
||
|
audio_name,
|
||
|
audio_blob,
|
||
|
audio_type,
|
||
|
audio_url,
|
||
|
frequency,
|
||
|
frequencies,
|
||
|
patches,
|
||
|
tg_label,
|
||
|
source
|
||
|
) VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
|
||
|
RETURNING id, submitter, system, talkgroup, date, audio_name, audio_blob, audio_type, audio_url, frequency, frequencies, patches, tg_label, source, transcript
|
||
|
`
|
||
|
|
||
|
type AddCallParams struct {
|
||
|
Submitter pgtype.Int4
|
||
|
System int32
|
||
|
Talkgroup int32
|
||
|
Date pgtype.Timestamp
|
||
|
AudioName pgtype.Text
|
||
|
AudioBlob []byte
|
||
|
AudioType pgtype.Text
|
||
|
AudioUrl pgtype.Text
|
||
|
Frequency pgtype.Int4
|
||
|
Frequencies []byte
|
||
|
Patches []byte
|
||
|
TgLabel pgtype.Text
|
||
|
Source pgtype.Text
|
||
|
}
|
||
|
|
||
|
func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (Call, error) {
|
||
|
row := q.db.QueryRow(ctx, addCall,
|
||
|
arg.Submitter,
|
||
|
arg.System,
|
||
|
arg.Talkgroup,
|
||
|
arg.Date,
|
||
|
arg.AudioName,
|
||
|
arg.AudioBlob,
|
||
|
arg.AudioType,
|
||
|
arg.AudioUrl,
|
||
|
arg.Frequency,
|
||
|
arg.Frequencies,
|
||
|
arg.Patches,
|
||
|
arg.TgLabel,
|
||
|
arg.Source,
|
||
|
)
|
||
|
var i Call
|
||
|
err := row.Scan(
|
||
|
&i.ID,
|
||
|
&i.Submitter,
|
||
|
&i.System,
|
||
|
&i.Talkgroup,
|
||
|
&i.Date,
|
||
|
&i.AudioName,
|
||
|
&i.AudioBlob,
|
||
|
&i.AudioType,
|
||
|
&i.AudioUrl,
|
||
|
&i.Frequency,
|
||
|
&i.Frequencies,
|
||
|
&i.Patches,
|
||
|
&i.TgLabel,
|
||
|
&i.Source,
|
||
|
&i.Transcript,
|
||
|
)
|
||
|
return i, err
|
||
|
}
|
||
|
|
||
|
const updateCallTranscript = `-- name: UpdateCallTranscript :exec
|
||
|
UPDATE calls SET transcript = $2 WHERE id = $1
|
||
|
`
|
||
|
|
||
|
type UpdateCallTranscriptParams struct {
|
||
|
ID pgtype.UUID
|
||
|
Transcript pgtype.Text
|
||
|
}
|
||
|
|
||
|
func (q *Queries) UpdateCallTranscript(ctx context.Context, arg UpdateCallTranscriptParams) error {
|
||
|
_, err := q.db.Exec(ctx, updateCallTranscript, arg.ID, arg.Transcript)
|
||
|
return err
|
||
|
}
|