diff --git a/internal/db/dbq/system_playlists.sql.go b/internal/db/dbq/system_playlists.sql.go index 1584bd64..6fe365d8 100644 --- a/internal/db/dbq/system_playlists.sql.go +++ b/internal/db/dbq/system_playlists.sql.go @@ -290,7 +290,7 @@ SELECT COALESCE( t.track_number NULLS LAST, t.id LIMIT 1) -) +)::uuid AS id ` type PickTopPlayedTrackForArtistByUserParams struct { @@ -301,11 +301,12 @@ type PickTopPlayedTrackForArtistByUserParams struct { // "Songs like X" seed selection. Returns the user's most-played non-skipped // track by artist X in the last 7 days. Falls back to the artist's most- // recent album's first track if no plays exist. -func (q *Queries) PickTopPlayedTrackForArtistByUser(ctx context.Context, arg PickTopPlayedTrackForArtistByUserParams) (interface{}, error) { +// Cast to uuid so sqlc infers pgtype.UUID rather than interface{}. +func (q *Queries) PickTopPlayedTrackForArtistByUser(ctx context.Context, arg PickTopPlayedTrackForArtistByUserParams) (pgtype.UUID, error) { row := q.db.QueryRow(ctx, pickTopPlayedTrackForArtistByUser, arg.UserID, arg.ArtistID) - var coalesce interface{} - err := row.Scan(&coalesce) - return coalesce, err + var id pgtype.UUID + err := row.Scan(&id) + return id, err } const pickTopPlayedTrackForUser = `-- name: PickTopPlayedTrackForUser :one diff --git a/internal/db/queries/system_playlists.sql b/internal/db/queries/system_playlists.sql index 800df762..0ae5326a 100644 --- a/internal/db/queries/system_playlists.sql +++ b/internal/db/queries/system_playlists.sql @@ -86,6 +86,7 @@ SELECT t.id -- "Songs like X" seed selection. Returns the user's most-played non-skipped -- track by artist X in the last 7 days. Falls back to the artist's most- -- recent album's first track if no plays exist. +-- Cast to uuid so sqlc infers pgtype.UUID rather than interface{}. SELECT COALESCE( (SELECT t.id FROM play_events pe @@ -106,7 +107,7 @@ SELECT COALESCE( t.track_number NULLS LAST, t.id LIMIT 1) -); +)::uuid AS id; -- name: PickTopAlbumCoverForArtistByUser :one -- "Songs like X" cover. Most-played album by user; tie-break by most-recent