Files
minstrel/internal/db/dbq/normalization_prefs.sql.go
T
bvandeusenandClaude Opus 5.5 285a24f0ab
release / web (push) Successful in 1m13s
release / go (push) Successful in 1m48s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 3m56s
release / android (push) Successful in 4m19s
release / Build signed APK (push) Successful in 4m40s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 14s
release / Verify release artifacts (tag releases only) (push) Skipped
feat(db): fold every migration into one baseline at version 106
0106_baseline.up.sql is the schema at version 106 and the settings rows
it starts with, taken from a database migrated through 0001–0106; a
database built from the baseline alone dumps identically. A database
already at 106 skips it. Comments that pointed at a migration number now
name the table or constraint instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:57:18 -05:00

82 lines
1.9 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: normalization_prefs.sql
package dbq
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getNormalizationPrefs = `-- name: GetNormalizationPrefs :one
SELECT mode, target_lufs, boost, updated_at
FROM user_normalization_prefs
WHERE user_id = $1
`
type GetNormalizationPrefsRow struct {
Mode string
TargetLufs int16
Boost string
UpdatedAt pgtype.Timestamptz
}
func (q *Queries) GetNormalizationPrefs(ctx context.Context, userID pgtype.UUID) (GetNormalizationPrefsRow, error) {
row := q.db.QueryRow(ctx, getNormalizationPrefs, userID)
var i GetNormalizationPrefsRow
err := row.Scan(
&i.Mode,
&i.TargetLufs,
&i.Boost,
&i.UpdatedAt,
)
return i, err
}
const upsertNormalizationPrefs = `-- name: UpsertNormalizationPrefs :one
INSERT INTO user_normalization_prefs (user_id, mode, target_lufs, boost)
VALUES ($1, $2, $3, $4)
ON CONFLICT (user_id) DO UPDATE SET
mode = EXCLUDED.mode,
target_lufs = EXCLUDED.target_lufs,
boost = EXCLUDED.boost,
updated_at = now()
RETURNING mode, target_lufs, boost, updated_at
`
type UpsertNormalizationPrefsParams struct {
UserID pgtype.UUID
Mode string
TargetLufs int16
Boost string
}
type UpsertNormalizationPrefsRow struct {
Mode string
TargetLufs int16
Boost string
UpdatedAt pgtype.Timestamptz
}
// Whole-row write from either client; the CHECKs on user_normalization_prefs back the
// handler's own validation.
func (q *Queries) UpsertNormalizationPrefs(ctx context.Context, arg UpsertNormalizationPrefsParams) (UpsertNormalizationPrefsRow, error) {
row := q.db.QueryRow(ctx, upsertNormalizationPrefs,
arg.UserID,
arg.Mode,
arg.TargetLufs,
arg.Boost,
)
var i UpsertNormalizationPrefsRow
err := row.Scan(
&i.Mode,
&i.TargetLufs,
&i.Boost,
&i.UpdatedAt,
)
return i, err
}