2024-07-16 19:31:30 -04:00
|
|
|
// Code generated by sqlc. DO NOT EDIT.
|
|
|
|
// versions:
|
|
|
|
// sqlc v1.26.0
|
|
|
|
// source: calls.sql
|
|
|
|
|
|
|
|
package database
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2024-07-24 22:42:30 -04:00
|
|
|
"github.com/google/uuid"
|
2024-07-16 19:31:30 -04:00
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
|
|
)
|
|
|
|
|
|
|
|
const addCall = `-- name: AddCall :one
|
|
|
|
INSERT INTO calls (
|
|
|
|
id,
|
|
|
|
submitter,
|
|
|
|
system,
|
|
|
|
talkgroup,
|
2024-07-16 19:35:16 -04:00
|
|
|
call_date,
|
2024-07-16 19:31:30 -04:00
|
|
|
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)
|
2024-07-16 19:35:16 -04:00
|
|
|
RETURNING id, submitter, system, talkgroup, call_date, audio_name, audio_blob, audio_type, audio_url, frequency, frequencies, patches, tg_label, source, transcript
|
2024-07-16 19:31:30 -04:00
|
|
|
`
|
|
|
|
|
|
|
|
type AddCallParams struct {
|
|
|
|
Submitter pgtype.Int4
|
|
|
|
System int32
|
|
|
|
Talkgroup int32
|
2024-07-16 19:35:16 -04:00
|
|
|
CallDate pgtype.Timestamp
|
2024-07-16 19:31:30 -04:00
|
|
|
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,
|
2024-07-16 19:35:16 -04:00
|
|
|
arg.CallDate,
|
2024-07-16 19:31:30 -04:00
|
|
|
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,
|
2024-07-16 19:35:16 -04:00
|
|
|
&i.CallDate,
|
2024-07-16 19:31:30 -04:00
|
|
|
&i.AudioName,
|
|
|
|
&i.AudioBlob,
|
|
|
|
&i.AudioType,
|
|
|
|
&i.AudioUrl,
|
|
|
|
&i.Frequency,
|
|
|
|
&i.Frequencies,
|
|
|
|
&i.Patches,
|
|
|
|
&i.TgLabel,
|
|
|
|
&i.Source,
|
|
|
|
&i.Transcript,
|
|
|
|
)
|
|
|
|
return i, err
|
|
|
|
}
|
|
|
|
|
2024-07-17 19:33:09 -04:00
|
|
|
const setCallTranscript = `-- name: SetCallTranscript :exec
|
2024-07-16 19:31:30 -04:00
|
|
|
UPDATE calls SET transcript = $2 WHERE id = $1
|
|
|
|
`
|
|
|
|
|
2024-07-24 22:42:30 -04:00
|
|
|
func (q *Queries) SetCallTranscript(ctx context.Context, iD uuid.UUID, transcript pgtype.Text) error {
|
2024-07-22 08:39:33 -04:00
|
|
|
_, err := q.db.Exec(ctx, setCallTranscript, iD, transcript)
|
2024-07-16 19:31:30 -04:00
|
|
|
return err
|
|
|
|
}
|