feat(db): add paged + count queries for library reads
This commit is contained in:
@@ -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
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user