fixed code generation with sqlc
This commit is contained in:
@@ -7,7 +7,8 @@ import (
|
|||||||
_ "modernc.org/sqlite"
|
_ "modernc.org/sqlite"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate sqlc vet && sqlc generate
|
//go:generate sqlc vet
|
||||||
|
//go:generate sqlc generate
|
||||||
|
|
||||||
type DB struct{
|
type DB struct{
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: artist_credit.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createArtistCredit = `-- name: CreateArtistCredit :one
|
||||||
|
INSERT INTO artist_credit (text) VALUES (?)
|
||||||
|
RETURNING id, text
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CreateArtistCredit(ctx context.Context, text interface{}) (ArtistCredit, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createArtistCredit, text)
|
||||||
|
var i ArtistCredit
|
||||||
|
err := row.Scan(&i.ID, &i.Text)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteArtistCredit = `-- name: DeleteArtistCredit :exec
|
||||||
|
DELETE FROM artist_credit
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteArtistCredit(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteArtistCredit, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getArtistCredit = `-- name: GetArtistCredit :one
|
||||||
|
SELECT id, text FROM artist_credit
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetArtistCredit(ctx context.Context, id int64) (ArtistCredit, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getArtistCredit, id)
|
||||||
|
var i ArtistCredit
|
||||||
|
err := row.Scan(&i.ID, &i.Text)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateArtistCredit = `-- name: UpdateArtistCredit :exec
|
||||||
|
UPDATE artist_credit
|
||||||
|
SET text = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateArtistCreditParams struct {
|
||||||
|
Text interface{}
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateArtistCredit(ctx context.Context, arg UpdateArtistCreditParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateArtistCredit, arg.Text, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: artist_credit_artists.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createArtistCreditArtist = `-- name: CreateArtistCreditArtist :one
|
||||||
|
INSERT INTO artist_credit_artist (artist_id, credit_id) VALUES (?, ?)
|
||||||
|
RETURNING id, artist_id, credit_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type CreateArtistCreditArtistParams struct {
|
||||||
|
ArtistID int64
|
||||||
|
CreditID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) CreateArtistCreditArtist(ctx context.Context, arg CreateArtistCreditArtistParams) (ArtistCreditArtist, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createArtistCreditArtist, arg.ArtistID, arg.CreditID)
|
||||||
|
var i ArtistCreditArtist
|
||||||
|
err := row.Scan(&i.ID, &i.ArtistID, &i.CreditID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteArtistCreditArtist = `-- name: DeleteArtistCreditArtist :exec
|
||||||
|
DELETE FROM artist_credit_artist
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteArtistCreditArtist(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteArtistCreditArtist, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getArtistCreditArtist = `-- name: GetArtistCreditArtist :one
|
||||||
|
SELECT id, artist_id, credit_id FROM artist_credit_artist
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetArtistCreditArtist(ctx context.Context, id int64) (ArtistCreditArtist, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getArtistCreditArtist, id)
|
||||||
|
var i ArtistCreditArtist
|
||||||
|
err := row.Scan(&i.ID, &i.ArtistID, &i.CreditID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateArtistCreditArtist = `-- name: UpdateArtistCreditArtist :exec
|
||||||
|
UPDATE artist_credit_artist
|
||||||
|
SET artist_id = ?, credit_id = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateArtistCreditArtistParams struct {
|
||||||
|
ArtistID int64
|
||||||
|
CreditID int64
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateArtistCreditArtist(ctx context.Context, arg UpdateArtistCreditArtistParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateArtistCreditArtist, arg.ArtistID, arg.CreditID, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: artists.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createArtist = `-- name: CreateArtist :one
|
||||||
|
INSERT INTO artists (name) VALUES (?)
|
||||||
|
RETURNING id, name
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CreateArtist(ctx context.Context, name string) (Artist, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createArtist, name)
|
||||||
|
var i Artist
|
||||||
|
err := row.Scan(&i.ID, &i.Name)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteArtist = `-- name: DeleteArtist :exec
|
||||||
|
DELETE FROM artists
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteArtist(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteArtist, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getArtist = `-- name: GetArtist :one
|
||||||
|
SELECT id, name FROM artists
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetArtist(ctx context.Context, id int64) (Artist, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getArtist, id)
|
||||||
|
var i Artist
|
||||||
|
err := row.Scan(&i.ID, &i.Name)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateArtist = `-- name: UpdateArtist :exec
|
||||||
|
UPDATE artists
|
||||||
|
SET name = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateArtistParams struct {
|
||||||
|
Name string
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateArtist(ctx context.Context, arg UpdateArtistParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateArtist, arg.Name, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: audio_files.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createAudioFile = `-- name: CreateAudioFile :one
|
||||||
|
INSERT INTO audio_files (file_path, length_milliseconds, file_type_id, recording_id) VALUES (?, ?, ?, ?)
|
||||||
|
RETURNING id, file_path, length_milliseconds, file_type_id, recording_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type CreateAudioFileParams struct {
|
||||||
|
FilePath string
|
||||||
|
LengthMilliseconds int64
|
||||||
|
FileTypeID int64
|
||||||
|
RecordingID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) CreateAudioFile(ctx context.Context, arg CreateAudioFileParams) (AudioFile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createAudioFile,
|
||||||
|
arg.FilePath,
|
||||||
|
arg.LengthMilliseconds,
|
||||||
|
arg.FileTypeID,
|
||||||
|
arg.RecordingID,
|
||||||
|
)
|
||||||
|
var i AudioFile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.FilePath,
|
||||||
|
&i.LengthMilliseconds,
|
||||||
|
&i.FileTypeID,
|
||||||
|
&i.RecordingID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteAudioFile = `-- name: DeleteAudioFile :exec
|
||||||
|
DELETE FROM audio_files
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteAudioFile(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteAudioFile, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getAudioFile = `-- name: GetAudioFile :one
|
||||||
|
SELECT id, file_path, length_milliseconds, file_type_id, recording_id FROM audio_files
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetAudioFile(ctx context.Context, id int64) (AudioFile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getAudioFile, id)
|
||||||
|
var i AudioFile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.FilePath,
|
||||||
|
&i.LengthMilliseconds,
|
||||||
|
&i.FileTypeID,
|
||||||
|
&i.RecordingID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateAudioFile = `-- name: UpdateAudioFile :exec
|
||||||
|
UPDATE audio_files
|
||||||
|
SET file_path = ?, length_milliseconds = ?, file_type_id = ?, recording_id = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateAudioFileParams struct {
|
||||||
|
FilePath string
|
||||||
|
LengthMilliseconds int64
|
||||||
|
FileTypeID int64
|
||||||
|
RecordingID int64
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateAudioFile(ctx context.Context, arg UpdateAudioFileParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateAudioFile,
|
||||||
|
arg.FilePath,
|
||||||
|
arg.LengthMilliseconds,
|
||||||
|
arg.FileTypeID,
|
||||||
|
arg.RecordingID,
|
||||||
|
arg.ID,
|
||||||
|
)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: cover_art.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createCoverArt = `-- name: CreateCoverArt :one
|
||||||
|
INSERT INTO cover_art (is_embedded, file_path, file_type_id) VALUES (?, ?, ?)
|
||||||
|
RETURNING id, is_embedded, file_path, file_type_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type CreateCoverArtParams struct {
|
||||||
|
IsEmbedded bool
|
||||||
|
FilePath string
|
||||||
|
FileTypeID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) CreateCoverArt(ctx context.Context, arg CreateCoverArtParams) (CoverArt, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createCoverArt, arg.IsEmbedded, arg.FilePath, arg.FileTypeID)
|
||||||
|
var i CoverArt
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.IsEmbedded,
|
||||||
|
&i.FilePath,
|
||||||
|
&i.FileTypeID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteCoverArt = `-- name: DeleteCoverArt :exec
|
||||||
|
DELETE FROM cover_art
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteCoverArt(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteCoverArt, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCoverArt = `-- name: GetCoverArt :one
|
||||||
|
SELECT id, is_embedded, file_path, file_type_id FROM cover_art
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetCoverArt(ctx context.Context, id int64) (CoverArt, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getCoverArt, id)
|
||||||
|
var i CoverArt
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.IsEmbedded,
|
||||||
|
&i.FilePath,
|
||||||
|
&i.FileTypeID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateCoverArt = `-- name: UpdateCoverArt :exec
|
||||||
|
UPDATE cover_art
|
||||||
|
SET is_embedded = ?, file_path = ?, file_type_id = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateCoverArtParams struct {
|
||||||
|
IsEmbedded bool
|
||||||
|
FilePath string
|
||||||
|
FileTypeID int64
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateCoverArt(ctx context.Context, arg UpdateCoverArtParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateCoverArt,
|
||||||
|
arg.IsEmbedded,
|
||||||
|
arg.FilePath,
|
||||||
|
arg.FileTypeID,
|
||||||
|
arg.ID,
|
||||||
|
)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: file_types.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createFileType = `-- name: CreateFileType :one
|
||||||
|
INSERT INTO file_types (extension) VALUES (?)
|
||||||
|
RETURNING id, extension
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CreateFileType(ctx context.Context, extension string) (FileType, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createFileType, extension)
|
||||||
|
var i FileType
|
||||||
|
err := row.Scan(&i.ID, &i.Extension)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteFileType = `-- name: DeleteFileType :exec
|
||||||
|
DELETE FROM file_types
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteFileType(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteFileType, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getFileType = `-- name: GetFileType :one
|
||||||
|
SELECT id, extension FROM file_types
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetFileType(ctx context.Context, id int64) (FileType, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getFileType, id)
|
||||||
|
var i FileType
|
||||||
|
err := row.Scan(&i.ID, &i.Extension)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateFileType = `-- name: UpdateFileType :exec
|
||||||
|
UPDATE file_types
|
||||||
|
SET extension = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateFileTypeParams struct {
|
||||||
|
Extension string
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateFileType(ctx context.Context, arg UpdateFileTypeParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateFileType, arg.Extension, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -15,19 +15,24 @@ type ArtistCredit struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ArtistCreditArtist struct {
|
type ArtistCreditArtist struct {
|
||||||
ID int64
|
ID int64
|
||||||
|
ArtistID int64
|
||||||
|
CreditID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type AudioFile struct {
|
type AudioFile struct {
|
||||||
ID int64
|
ID int64
|
||||||
FilePath string
|
FilePath string
|
||||||
LengthMilliseconds int64
|
LengthMilliseconds int64
|
||||||
|
FileTypeID int64
|
||||||
|
RecordingID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type CoverArt struct {
|
type CoverArt struct {
|
||||||
ID int64
|
ID int64
|
||||||
IsEmbedded bool
|
IsEmbedded bool
|
||||||
FilePath string
|
FilePath string
|
||||||
|
FileTypeID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type FileType struct {
|
type FileType struct {
|
||||||
@@ -36,15 +41,19 @@ type FileType struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Recording struct {
|
type Recording struct {
|
||||||
ID int64
|
ID int64
|
||||||
Name string
|
Name string
|
||||||
|
ArtistCreditID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseGroup struct {
|
type ReleaseGroup struct {
|
||||||
ID int64
|
ID int64
|
||||||
Name string
|
Name string
|
||||||
|
CoverArtID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseGroupRecording struct {
|
type ReleaseGroupRecording struct {
|
||||||
ID int64
|
ID int64
|
||||||
|
ReleaseGroupID int64
|
||||||
|
RecordingID int64
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,52 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
)
|
)
|
||||||
|
|
||||||
const getAuthor = `-- name: GetAuthor :one
|
const createRecording = `-- name: CreateRecording :one
|
||||||
SELECT id, name FROM recordings
|
INSERT INTO recordings (name) VALUES (?)
|
||||||
|
RETURNING id, name, artist_credit_id
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CreateRecording(ctx context.Context, name string) (Recording, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createRecording, name)
|
||||||
|
var i Recording
|
||||||
|
err := row.Scan(&i.ID, &i.Name, &i.ArtistCreditID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteRecording = `-- name: DeleteRecording :exec
|
||||||
|
DELETE FROM recordings
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteRecording(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteRecording, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getRecording = `-- name: GetRecording :one
|
||||||
|
SELECT id, name, artist_credit_id FROM recordings
|
||||||
WHERE id = ? LIMIT 1
|
WHERE id = ? LIMIT 1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetAuthor(ctx context.Context, id int64) (Recording, error) {
|
func (q *Queries) GetRecording(ctx context.Context, id int64) (Recording, error) {
|
||||||
row := q.db.QueryRowContext(ctx, getAuthor, id)
|
row := q.db.QueryRowContext(ctx, getRecording, id)
|
||||||
var i Recording
|
var i Recording
|
||||||
err := row.Scan(&i.ID, &i.Name)
|
err := row.Scan(&i.ID, &i.Name, &i.ArtistCreditID)
|
||||||
return i, err
|
return i, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateRecording = `-- name: UpdateRecording :exec
|
||||||
|
UPDATE recordings
|
||||||
|
SET name = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateRecordingParams struct {
|
||||||
|
Name string
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateRecording(ctx context.Context, arg UpdateRecordingParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateRecording, arg.Name, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: release_group_recordings.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createReleaseGroupRecording = `-- name: CreateReleaseGroupRecording :one
|
||||||
|
INSERT INTO release_group_recordings (release_group_id, recording_id) VALUES (?,?)
|
||||||
|
RETURNING id, release_group_id, recording_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type CreateReleaseGroupRecordingParams struct {
|
||||||
|
ReleaseGroupID int64
|
||||||
|
RecordingID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) CreateReleaseGroupRecording(ctx context.Context, arg CreateReleaseGroupRecordingParams) (ReleaseGroupRecording, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createReleaseGroupRecording, arg.ReleaseGroupID, arg.RecordingID)
|
||||||
|
var i ReleaseGroupRecording
|
||||||
|
err := row.Scan(&i.ID, &i.ReleaseGroupID, &i.RecordingID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteReleaseGroupRecording = `-- name: DeleteReleaseGroupRecording :exec
|
||||||
|
DELETE FROM release_group_recordings
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteReleaseGroupRecording(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteReleaseGroupRecording, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getReleaseGroupRecording = `-- name: GetReleaseGroupRecording :one
|
||||||
|
SELECT id, release_group_id, recording_id FROM release_group_recordings
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetReleaseGroupRecording(ctx context.Context, id int64) (ReleaseGroupRecording, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getReleaseGroupRecording, id)
|
||||||
|
var i ReleaseGroupRecording
|
||||||
|
err := row.Scan(&i.ID, &i.ReleaseGroupID, &i.RecordingID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateReleaseGroupRecording = `-- name: UpdateReleaseGroupRecording :exec
|
||||||
|
UPDATE release_group_recordings
|
||||||
|
SET release_group_id = ?, recording_id = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateReleaseGroupRecordingParams struct {
|
||||||
|
ReleaseGroupID int64
|
||||||
|
RecordingID int64
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateReleaseGroupRecording(ctx context.Context, arg UpdateReleaseGroupRecordingParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateReleaseGroupRecording, arg.ReleaseGroupID, arg.RecordingID, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.28.0
|
||||||
|
// source: release_groups.sql
|
||||||
|
|
||||||
|
package sqlcgen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const createReleaseGroup = `-- name: CreateReleaseGroup :one
|
||||||
|
INSERT INTO release_groups (name) VALUES (?)
|
||||||
|
RETURNING id, name, cover_art_id
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CreateReleaseGroup(ctx context.Context, name string) (ReleaseGroup, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createReleaseGroup, name)
|
||||||
|
var i ReleaseGroup
|
||||||
|
err := row.Scan(&i.ID, &i.Name, &i.CoverArtID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const deleteReleaseGroup = `-- name: DeleteReleaseGroup :exec
|
||||||
|
DELETE FROM release_groups
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) DeleteReleaseGroup(ctx context.Context, id int64) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, deleteReleaseGroup, id)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getReleaseGroup = `-- name: GetReleaseGroup :one
|
||||||
|
SELECT id, name, cover_art_id FROM release_groups
|
||||||
|
WHERE id = ? LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetReleaseGroup(ctx context.Context, id int64) (ReleaseGroup, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getReleaseGroup, id)
|
||||||
|
var i ReleaseGroup
|
||||||
|
err := row.Scan(&i.ID, &i.Name, &i.CoverArtID)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateReleaseGroup = `-- name: UpdateReleaseGroup :exec
|
||||||
|
UPDATE release_groups
|
||||||
|
SET name = ?
|
||||||
|
WHERE id =?
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateReleaseGroupParams struct {
|
||||||
|
Name string
|
||||||
|
ID int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateReleaseGroup(ctx context.Context, arg UpdateReleaseGroupParams) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, updateReleaseGroup, arg.Name, arg.ID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user