mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 20:11:50 -07:00
feat: search/merge items by id
This commit is contained in:
parent
5537b6fb89
commit
1425f7f416
9 changed files with 752 additions and 46 deletions
|
|
@ -85,13 +85,26 @@ func (q *Queries) DeleteReleasesFromArtist(ctx context.Context, artistID int32)
|
|||
}
|
||||
|
||||
const getRelease = `-- name: GetRelease :one
|
||||
SELECT id, musicbrainz_id, image, various_artists, image_source, title FROM releases_with_title
|
||||
SELECT
|
||||
id, musicbrainz_id, image, various_artists, image_source, title,
|
||||
get_artists_for_release(id) AS artists
|
||||
FROM releases_with_title
|
||||
WHERE id = $1 LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) GetRelease(ctx context.Context, id int32) (ReleasesWithTitle, error) {
|
||||
type GetReleaseRow struct {
|
||||
ID int32
|
||||
MusicBrainzID *uuid.UUID
|
||||
Image *uuid.UUID
|
||||
VariousArtists bool
|
||||
ImageSource pgtype.Text
|
||||
Title string
|
||||
Artists []byte
|
||||
}
|
||||
|
||||
func (q *Queries) GetRelease(ctx context.Context, id int32) (GetReleaseRow, error) {
|
||||
row := q.db.QueryRow(ctx, getRelease, id)
|
||||
var i ReleasesWithTitle
|
||||
var i GetReleaseRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.MusicBrainzID,
|
||||
|
|
@ -99,6 +112,7 @@ func (q *Queries) GetRelease(ctx context.Context, id int32) (ReleasesWithTitle,
|
|||
&i.VariousArtists,
|
||||
&i.ImageSource,
|
||||
&i.Title,
|
||||
&i.Artists,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue