M1/#293: regenerate sqlc output for GetAlbumByArtistAndTitle
This commit is contained in:
@@ -11,6 +11,33 @@ import (
|
|||||||
"github.com/jackc/pgx/v5/pgtype"
|
"github.com/jackc/pgx/v5/pgtype"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const getAlbumByArtistAndTitle = `-- name: GetAlbumByArtistAndTitle :one
|
||||||
|
SELECT id, title, sort_title, artist_id, release_date, mbid, cover_art_path, created_at, updated_at FROM albums WHERE artist_id = $1 AND title = $2 LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
type GetAlbumByArtistAndTitleParams struct {
|
||||||
|
ArtistID pgtype.UUID
|
||||||
|
Title string
|
||||||
|
}
|
||||||
|
|
||||||
|
// Scanner uses this for the no-mbid dedupe path: resolve-or-create.
|
||||||
|
func (q *Queries) GetAlbumByArtistAndTitle(ctx context.Context, arg GetAlbumByArtistAndTitleParams) (Album, error) {
|
||||||
|
row := q.db.QueryRow(ctx, getAlbumByArtistAndTitle, arg.ArtistID, arg.Title)
|
||||||
|
var i Album
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.Title,
|
||||||
|
&i.SortTitle,
|
||||||
|
&i.ArtistID,
|
||||||
|
&i.ReleaseDate,
|
||||||
|
&i.Mbid,
|
||||||
|
&i.CoverArtPath,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
const getAlbumByID = `-- name: GetAlbumByID :one
|
const getAlbumByID = `-- name: GetAlbumByID :one
|
||||||
SELECT id, title, sort_title, artist_id, release_date, mbid, cover_art_path, created_at, updated_at FROM albums WHERE id = $1
|
SELECT id, title, sort_title, artist_id, release_date, mbid, cover_art_path, created_at, updated_at FROM albums WHERE id = $1
|
||||||
`
|
`
|
||||||
|
|||||||
Reference in New Issue
Block a user