From 234671bc9dee3a177f89321696e7d2ca282de8ca Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Sun, 28 Jul 2024 09:01:30 -0400 Subject: [PATCH] Don't return everything since bytea included --- pkg/gordio/database/calls.sql.go | 28 +++++----------------------- sql/postgres/queries/calls.sql | 2 +- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/pkg/gordio/database/calls.sql.go b/pkg/gordio/database/calls.sql.go index af4a68b..db586f1 100644 --- a/pkg/gordio/database/calls.sql.go +++ b/pkg/gordio/database/calls.sql.go @@ -31,7 +31,7 @@ INSERT INTO calls ( 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 +RETURNING id ` type AddCallParams struct { @@ -52,7 +52,7 @@ type AddCallParams struct { Source int `json:"source"` } -func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (Call, error) { +func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (uuid.UUID, error) { row := q.db.QueryRow(ctx, addCall, arg.Submitter, arg.System, @@ -70,27 +70,9 @@ func (q *Queries) AddCall(ctx context.Context, arg AddCallParams) (Call, error) 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 + var id uuid.UUID + err := row.Scan(&id) + return id, err } const setCallTranscript = `-- name: SetCallTranscript :exec diff --git a/sql/postgres/queries/calls.sql b/sql/postgres/queries/calls.sql index 42a1f77..6079aba 100644 --- a/sql/postgres/queries/calls.sql +++ b/sql/postgres/queries/calls.sql @@ -17,7 +17,7 @@ INSERT INTO calls ( tg_group, source ) VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) -RETURNING *; +RETURNING id; -- name: SetCallTranscript :exec UPDATE calls SET transcript = $2 WHERE id = $1;