stillbox/pkg/gordio/database/calls.sql.go

100 lines
2.2 KiB
Go
Raw Normal View History

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-26 09:29:58 -04:00
"time"
2024-07-16 19:31:30 -04:00
2024-07-24 22:42:30 -04:00
"github.com/google/uuid"
2024-07-16 19:31:30 -04:00
)
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,
2024-08-11 13:46:43 -04:00
duration,
2024-07-16 19:31:30 -04:00
frequency,
frequencies,
patches,
tg_label,
2024-08-23 14:28:47 -04:00
tg_alpha_tag,
2024-07-27 19:25:16 -04:00
tg_group,
2024-07-16 19:31:30 -04:00
source
2024-08-11 13:46:43 -04:00
) VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
RETURNING id
2024-07-16 19:31:30 -04:00
`
type AddCallParams struct {
2024-07-26 09:29:58 -04:00
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"`
2024-08-11 13:46:43 -04:00
Duration *int32 `json:"duration"`
2024-07-27 19:25:16 -04:00
Frequency int `json:"frequency"`
Frequencies []int `json:"frequencies"`
Patches []int `json:"patches"`
2024-07-26 09:29:58 -04:00
TgLabel *string `json:"tg_label"`
2024-08-23 14:28:47 -04:00
TgAlphaTag *string `json:"tg_alpha_tag"`
2024-07-27 19:25:16 -04:00
TgGroup *string `json:"tg_group"`
Source int `json:"source"`
2024-07-16 19:31:30 -04:00
}
func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (uuid.UUID, error) {
2024-07-16 19:31:30 -04:00
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,
2024-08-11 13:46:43 -04:00
arg.Duration,
2024-07-16 19:31:30 -04:00
arg.Frequency,
arg.Frequencies,
arg.Patches,
arg.TgLabel,
2024-08-23 14:28:47 -04:00
arg.TgAlphaTag,
2024-07-27 19:25:16 -04:00
arg.TgGroup,
2024-07-16 19:31:30 -04:00
arg.Source,
)
var id uuid.UUID
err := row.Scan(&id)
return id, err
2024-07-16 19:31:30 -04:00
}
2024-10-20 12:26:32 -04:00
const getCallsTableSize = `-- name: GetCallsTableSize :one
SELECT pg_size_pretty(pg_total_relation_size('calls'))
`
func (q *Queries) GetCallsTableSize(ctx context.Context) (string, error) {
row := q.db.QueryRow(ctx, getCallsTableSize)
var pg_size_pretty string
err := row.Scan(&pg_size_pretty)
return pg_size_pretty, 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-25 09:37:27 -04:00
func (q *Queries) SetCallTranscript(ctx context.Context, iD uuid.UUID, transcript *string) 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
}