feat(06-03): migrate lookupChunk to sqlc-generated LookupTrackMetaByPaths query

- Add LookupTrackMetaByPaths sqlc query using track_metadata VIEW with sqlc.slice()
- Replace hand-crafted fmt.Sprintf IN clause in lookupChunk with sqlc-generated call
- Preserve lookupTrackMetaBatch chunking at maxSQLiteVars (900)
- All queue tests pass with -race
This commit is contained in:
2026-03-04 19:31:52 -05:00
parent 30579e950e
commit 2221a68459
3 changed files with 76 additions and 56 deletions
@@ -58,6 +58,7 @@ JOIN artist_credit ac ON r.artist_credit_id = ac.id;
-- name: GetTrackMetadataByPath :one
SELECT
af.file_path,
af.length_milliseconds,
COALESCE(r.name, '') AS title,
COALESCE(ac.text, '') AS artist,
COALESCE(rg.name, '') AS album,
@@ -121,6 +122,11 @@ LEFT JOIN release_groups rg ON rgr.release_group_id = rg.id
WHERE af.basename = ?
LIMIT ?;
-- name: LookupTrackMetaByPaths :many
SELECT id, file_path, title, artist_name
FROM track_metadata
WHERE file_path IN (sqlc.slice('paths'));
-- name: DeleteAllAudioFiles :exec
DELETE FROM audio_files;