stillbox/pkg/database/calls.sql.go
2024-11-19 10:18:12 -05:00

156 lines
3.2 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: calls.sql
package database
import (
"context"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
)
const addAlert = `-- name: AddAlert :exec
INSERT INTO alerts (time, tgid, system_id, weight, score, orig_score, notified, metadata)
VALUES
(
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8
)
`
type AddAlertParams struct {
Time pgtype.Timestamptz `json:"time"`
TGID int `json:"tgid"`
SystemID int `json:"system_id"`
Weight *float32 `json:"weight"`
Score *float32 `json:"score"`
OrigScore *float32 `json:"orig_score"`
Notified bool `json:"notified"`
Metadata []byte `json:"metadata"`
}
func (q *Queries) AddAlert(ctx context.Context, arg AddAlertParams) error {
_, err := q.db.Exec(ctx, addAlert,
arg.Time,
arg.TGID,
arg.SystemID,
arg.Weight,
arg.Score,
arg.OrigScore,
arg.Notified,
arg.Metadata,
)
return err
}
const addCall = `-- name: AddCall :exec
INSERT INTO calls (
id,
submitter,
system,
talkgroup,
call_date,
audio_name,
audio_blob,
audio_type,
audio_url,
duration,
frequency,
frequencies,
patches,
tg_label,
tg_alpha_tag,
tg_group,
source
) VALUES (
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8,
$9,
$10,
$11,
$12,
$13,
$14,
$15,
$16,
$17
)
`
type AddCallParams struct {
ID uuid.UUID `json:"id"`
Submitter *int32 `json:"submitter"`
System int `json:"system"`
Talkgroup int `json:"talkgroup"`
CallDate pgtype.Timestamptz `json:"call_date"`
AudioName *string `json:"audio_name"`
AudioBlob []byte `json:"audio_blob"`
AudioType *string `json:"audio_type"`
AudioUrl *string `json:"audio_url"`
Duration *int32 `json:"duration"`
Frequency int `json:"frequency"`
Frequencies []int `json:"frequencies"`
Patches []int `json:"patches"`
TGLabel *string `json:"tg_label"`
TGAlphaTag *string `json:"tg_alpha_tag"`
TGGroup *string `json:"tg_group"`
Source int `json:"source"`
}
func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) error {
_, err := q.db.Exec(ctx, addCall,
arg.ID,
arg.Submitter,
arg.System,
arg.Talkgroup,
arg.CallDate,
arg.AudioName,
arg.AudioBlob,
arg.AudioType,
arg.AudioUrl,
arg.Duration,
arg.Frequency,
arg.Frequencies,
arg.Patches,
arg.TGLabel,
arg.TGAlphaTag,
arg.TGGroup,
arg.Source,
)
return err
}
const getDatabaseSize = `-- name: GetDatabaseSize :one
SELECT pg_size_pretty(pg_database_size(current_database()))
`
func (q *Queries) GetDatabaseSize(ctx context.Context) (string, error) {
row := q.db.QueryRow(ctx, getDatabaseSize)
var pg_size_pretty string
err := row.Scan(&pg_size_pretty)
return pg_size_pretty, 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
}