feat(quick-002): add CountPlaylistsByName SQL query and regenerate sqlc

- Add CountPlaylistsByName :one query to playlists.sql
- Regenerate sqlc to produce Go function
This commit is contained in:
2026-02-28 13:52:21 -05:00
parent 981bd046da
commit 04b2088b28
2 changed files with 14 additions and 0 deletions
@@ -41,6 +41,17 @@ func (q *Queries) ClearPlaylistTracks(ctx context.Context, playlistID int64) err
return err
}
const countPlaylistsByName = `-- name: CountPlaylistsByName :one
SELECT COUNT(*) AS count FROM playlists WHERE name = ?
`
func (q *Queries) CountPlaylistsByName(ctx context.Context, name string) (int64, error) {
row := q.db.QueryRowContext(ctx, countPlaylistsByName, name)
var count int64
err := row.Scan(&count)
return count, err
}
const createPlaylist = `-- name: CreatePlaylist :one
INSERT INTO playlists (name) VALUES (?)
RETURNING id, name, created_at, updated_at