diff --git a/pkg/gordio/admin/admin.go b/pkg/gordio/admin/admin.go index 585e693..9f224cb 100644 --- a/pkg/gordio/admin/admin.go +++ b/pkg/gordio/admin/admin.go @@ -94,10 +94,7 @@ func passwd(cfg *config.Config, username string) error { hashpw, err := bcrypt.GenerateFromPassword([]byte(pw), bcrypt.DefaultCost) - return database.New(db).UpdatePassword(context.Background(), database.UpdatePasswordParams{ - Username: username, - Password: string(hashpw), - }) + return database.New(db).UpdatePassword(context.Background(), username, string(hashpw)) } func readPassword(prompt string) (string, error) { diff --git a/pkg/gordio/database/calls.sql.go b/pkg/gordio/database/calls.sql.go index bba4313..3a13edd 100644 --- a/pkg/gordio/database/calls.sql.go +++ b/pkg/gordio/database/calls.sql.go @@ -88,12 +88,7 @@ const setCallTranscript = `-- name: SetCallTranscript :exec UPDATE calls SET transcript = $2 WHERE id = $1 ` -type SetCallTranscriptParams struct { - ID pgtype.UUID - Transcript pgtype.Text -} - -func (q *Queries) SetCallTranscript(ctx context.Context, arg SetCallTranscriptParams) error { - _, err := q.db.Exec(ctx, setCallTranscript, arg.ID, arg.Transcript) +func (q *Queries) SetCallTranscript(ctx context.Context, iD pgtype.UUID, transcript pgtype.Text) error { + _, err := q.db.Exec(ctx, setCallTranscript, iD, transcript) return err } diff --git a/pkg/gordio/database/talkgroups.sql.go b/pkg/gordio/database/talkgroups.sql.go index 4e40834..b005664 100644 --- a/pkg/gordio/database/talkgroups.sql.go +++ b/pkg/gordio/database/talkgroups.sql.go @@ -86,13 +86,7 @@ INSERT INTO talkgroups_tags(system_id, talkgroup_id, tags) VALUES($1, $2, $3) ON CONFLICT (system_id, talkgroup_id) DO UPDATE SET tags = $3 ` -type SetTalkgroupTagsParams struct { - SystemID int32 - TalkgroupID int32 - Tags []string -} - -func (q *Queries) SetTalkgroupTags(ctx context.Context, arg SetTalkgroupTagsParams) error { - _, err := q.db.Exec(ctx, setTalkgroupTags, arg.SystemID, arg.TalkgroupID, arg.Tags) +func (q *Queries) SetTalkgroupTags(ctx context.Context, systemID int32, talkgroupID int32, tags []string) error { + _, err := q.db.Exec(ctx, setTalkgroupTags, systemID, talkgroupID, tags) return err } diff --git a/pkg/gordio/database/users.sql.go b/pkg/gordio/database/users.sql.go index 5c8b0ad..ab3d64c 100644 --- a/pkg/gordio/database/users.sql.go +++ b/pkg/gordio/database/users.sql.go @@ -22,14 +22,8 @@ INSERT INTO api_keys( RETURNING id, owner, created_at, expires, disabled, api_key ` -type CreateAPIKeyParams struct { - Owner pgtype.Int4 - Expires pgtype.Timestamp - Disabled pgtype.Bool -} - -func (q *Queries) CreateAPIKey(ctx context.Context, arg CreateAPIKeyParams) (ApiKey, error) { - row := q.db.QueryRow(ctx, createAPIKey, arg.Owner, arg.Expires, arg.Disabled) +func (q *Queries) CreateAPIKey(ctx context.Context, owner pgtype.Int4, expires pgtype.Timestamp, disabled pgtype.Bool) (ApiKey, error) { + row := q.db.QueryRow(ctx, createAPIKey, owner, expires, disabled) var i ApiKey err := row.Scan( &i.ID, @@ -188,12 +182,7 @@ const updatePassword = `-- name: UpdatePassword :exec UPDATE users SET password = $2 WHERE username = $1 ` -type UpdatePasswordParams struct { - Username string - Password string -} - -func (q *Queries) UpdatePassword(ctx context.Context, arg UpdatePasswordParams) error { - _, err := q.db.Exec(ctx, updatePassword, arg.Username, arg.Password) +func (q *Queries) UpdatePassword(ctx context.Context, username string, password string) error { + _, err := q.db.Exec(ctx, updatePassword, username, password) return err } diff --git a/sql/sqlc.yaml b/sql/sqlc.yaml index 185b5b5..42a81a7 100644 --- a/sql/sqlc.yaml +++ b/sql/sqlc.yaml @@ -8,3 +8,4 @@ sql: package: "database" out: "../pkg/gordio/database" sql_package: "pgx/v5" + query_parameter_limit: 3