stillbox/pkg/gordio/database/calls.sql.go
2024-07-27 19:25:16 -04:00

103 lines
2.2 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// source: calls.sql
package database
import (
"context"
"time"
"github.com/google/uuid"
)
const addCall = `-- name: AddCall :one
INSERT INTO calls (
id,
submitter,
system,
talkgroup,
call_date,
audio_name,
audio_blob,
audio_type,
audio_url,
frequency,
frequencies,
patches,
tg_label,
tg_tag,
tg_group,
source
) VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)
RETURNING id, submitter, system, talkgroup, call_date, audio_name, audio_blob, audio_type, audio_url, frequency, frequencies, patches, tg_label, tg_tag, tg_group, source, transcript
`
type AddCallParams struct {
Submitter *int32 `json:"submitter"`
System int `json:"system"`
Talkgroup int `json:"talkgroup"`
CallDate time.Time `json:"call_date"`
AudioName *string `json:"audio_name"`
AudioBlob []byte `json:"audio_blob"`
AudioType *string `json:"audio_type"`
AudioUrl *string `json:"audio_url"`
Frequency int `json:"frequency"`
Frequencies []int `json:"frequencies"`
Patches []int `json:"patches"`
TgLabel *string `json:"tg_label"`
TgTag *string `json:"tg_tag"`
TgGroup *string `json:"tg_group"`
Source int `json:"source"`
}
func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (Call, error) {
row := q.db.QueryRow(ctx, addCall,
arg.Submitter,
arg.System,
arg.Talkgroup,
arg.CallDate,
arg.AudioName,
arg.AudioBlob,
arg.AudioType,
arg.AudioUrl,
arg.Frequency,
arg.Frequencies,
arg.Patches,
arg.TgLabel,
arg.TgTag,
arg.TgGroup,
arg.Source,
)
var i Call
err := row.Scan(
&i.ID,
&i.Submitter,
&i.System,
&i.Talkgroup,
&i.CallDate,
&i.AudioName,
&i.AudioBlob,
&i.AudioType,
&i.AudioUrl,
&i.Frequency,
&i.Frequencies,
&i.Patches,
&i.TgLabel,
&i.TgTag,
&i.TgGroup,
&i.Source,
&i.Transcript,
)
return i, err
}
const setCallTranscript = `-- name: SetCallTranscript :exec
UPDATE calls SET transcript = $2 WHERE id = $1
`
func (q *Queries) SetCallTranscript(ctx context.Context, iD uuid.UUID, transcript *string) error {
_, err := q.db.Exec(ctx, setCallTranscript, iD, transcript)
return err
}