feat(db): add paged + count queries for library reads

This commit is contained in:
2026-04-21 00:01:15 -04:00
parent 62e48642e2
commit fb49a39492
6 changed files with 136 additions and 0 deletions
+11
View File
@@ -22,6 +22,17 @@ func (q *Queries) CountTracksByAlbum(ctx context.Context, albumID pgtype.UUID) (
return count, err
}
const countTracksMatching = `-- name: CountTracksMatching :one
SELECT COUNT(*) FROM tracks WHERE title ILIKE '%' || $1::text || '%'
`
func (q *Queries) CountTracksMatching(ctx context.Context, dollar_1 string) (int64, error) {
row := q.db.QueryRow(ctx, countTracksMatching, dollar_1)
var count int64
err := row.Scan(&count)
return count, err
}
const getTrackByID = `-- name: GetTrackByID :one
SELECT id, title, album_id, artist_id, track_number, disc_number, duration_ms, file_path, file_size, file_format, bitrate, mbid, genre, added_at, updated_at FROM tracks WHERE id = $1
`