Squash merge audio-player-component into main
This commit is contained in:
@@ -1,29 +1,94 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.28.0
|
||||
// sqlc v1.29.0
|
||||
// source: recordings.sql
|
||||
|
||||
package sqlcgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const createRecording = `-- name: CreateRecording :one
|
||||
INSERT INTO recordings (name) VALUES (?)
|
||||
RETURNING id, name, artist_credit_id
|
||||
INSERT INTO recordings (name, artist_credit_id) VALUES (?, ?)
|
||||
RETURNING id, name, artist_credit_id, track_number, disc_number, year, genre, composer, lyrics, comment
|
||||
`
|
||||
|
||||
func (q *Queries) CreateRecording(ctx context.Context, name string) (Recording, error) {
|
||||
row := q.db.QueryRowContext(ctx, createRecording, name)
|
||||
type CreateRecordingParams struct {
|
||||
Name string
|
||||
ArtistCreditID int64
|
||||
}
|
||||
|
||||
func (q *Queries) CreateRecording(ctx context.Context, arg CreateRecordingParams) (Recording, error) {
|
||||
row := q.db.QueryRowContext(ctx, createRecording, arg.Name, arg.ArtistCreditID)
|
||||
var i Recording
|
||||
err := row.Scan(&i.ID, &i.Name, &i.ArtistCreditID)
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.ArtistCreditID,
|
||||
&i.TrackNumber,
|
||||
&i.DiscNumber,
|
||||
&i.Year,
|
||||
&i.Genre,
|
||||
&i.Composer,
|
||||
&i.Lyrics,
|
||||
&i.Comment,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const createRecordingFull = `-- name: CreateRecordingFull :one
|
||||
INSERT INTO recordings (
|
||||
name, artist_credit_id, track_number, disc_number,
|
||||
year, genre, composer, lyrics, comment
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
RETURNING id, name, artist_credit_id, track_number, disc_number, year, genre, composer, lyrics, comment
|
||||
`
|
||||
|
||||
type CreateRecordingFullParams struct {
|
||||
Name string
|
||||
ArtistCreditID int64
|
||||
TrackNumber sql.NullInt64
|
||||
DiscNumber sql.NullInt64
|
||||
Year sql.NullInt64
|
||||
Genre sql.NullString
|
||||
Composer sql.NullString
|
||||
Lyrics sql.NullString
|
||||
Comment sql.NullString
|
||||
}
|
||||
|
||||
func (q *Queries) CreateRecordingFull(ctx context.Context, arg CreateRecordingFullParams) (Recording, error) {
|
||||
row := q.db.QueryRowContext(ctx, createRecordingFull,
|
||||
arg.Name,
|
||||
arg.ArtistCreditID,
|
||||
arg.TrackNumber,
|
||||
arg.DiscNumber,
|
||||
arg.Year,
|
||||
arg.Genre,
|
||||
arg.Composer,
|
||||
arg.Lyrics,
|
||||
arg.Comment,
|
||||
)
|
||||
var i Recording
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.ArtistCreditID,
|
||||
&i.TrackNumber,
|
||||
&i.DiscNumber,
|
||||
&i.Year,
|
||||
&i.Genre,
|
||||
&i.Composer,
|
||||
&i.Lyrics,
|
||||
&i.Comment,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteRecording = `-- name: DeleteRecording :exec
|
||||
DELETE FROM recordings
|
||||
WHERE id =?
|
||||
WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteRecording(ctx context.Context, id int64) error {
|
||||
@@ -31,30 +96,117 @@ func (q *Queries) DeleteRecording(ctx context.Context, id int64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
const getAllRecordings = `-- name: GetAllRecordings :many
|
||||
SELECT id, name, artist_credit_id, track_number, disc_number, year, genre, composer, lyrics, comment FROM recordings
|
||||
ORDER BY name
|
||||
`
|
||||
|
||||
func (q *Queries) GetAllRecordings(ctx context.Context) ([]Recording, error) {
|
||||
rows, err := q.db.QueryContext(ctx, getAllRecordings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Recording
|
||||
for rows.Next() {
|
||||
var i Recording
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.ArtistCreditID,
|
||||
&i.TrackNumber,
|
||||
&i.DiscNumber,
|
||||
&i.Year,
|
||||
&i.Genre,
|
||||
&i.Composer,
|
||||
&i.Lyrics,
|
||||
&i.Comment,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const getRecording = `-- name: GetRecording :one
|
||||
SELECT id, name, artist_credit_id FROM recordings
|
||||
SELECT id, name, artist_credit_id, track_number, disc_number, year, genre, composer, lyrics, comment FROM recordings
|
||||
WHERE id = ? LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) GetRecording(ctx context.Context, id int64) (Recording, error) {
|
||||
row := q.db.QueryRowContext(ctx, getRecording, id)
|
||||
var i Recording
|
||||
err := row.Scan(&i.ID, &i.Name, &i.ArtistCreditID)
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.ArtistCreditID,
|
||||
&i.TrackNumber,
|
||||
&i.DiscNumber,
|
||||
&i.Year,
|
||||
&i.Genre,
|
||||
&i.Composer,
|
||||
&i.Lyrics,
|
||||
&i.Comment,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const updateRecording = `-- name: UpdateRecording :exec
|
||||
UPDATE recordings
|
||||
SET name = ?
|
||||
WHERE id =?
|
||||
SET name = ?, artist_credit_id = ?
|
||||
WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateRecordingParams struct {
|
||||
Name string
|
||||
ID int64
|
||||
Name string
|
||||
ArtistCreditID int64
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateRecording(ctx context.Context, arg UpdateRecordingParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateRecording, arg.Name, arg.ID)
|
||||
_, err := q.db.ExecContext(ctx, updateRecording, arg.Name, arg.ArtistCreditID, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
const updateRecordingFull = `-- name: UpdateRecordingFull :exec
|
||||
UPDATE recordings
|
||||
SET name = ?, artist_credit_id = ?, track_number = ?, disc_number = ?,
|
||||
year = ?, genre = ?, composer = ?, lyrics = ?, comment = ?
|
||||
WHERE id = ?
|
||||
`
|
||||
|
||||
type UpdateRecordingFullParams struct {
|
||||
Name string
|
||||
ArtistCreditID int64
|
||||
TrackNumber sql.NullInt64
|
||||
DiscNumber sql.NullInt64
|
||||
Year sql.NullInt64
|
||||
Genre sql.NullString
|
||||
Composer sql.NullString
|
||||
Lyrics sql.NullString
|
||||
Comment sql.NullString
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) UpdateRecordingFull(ctx context.Context, arg UpdateRecordingFullParams) error {
|
||||
_, err := q.db.ExecContext(ctx, updateRecordingFull,
|
||||
arg.Name,
|
||||
arg.ArtistCreditID,
|
||||
arg.TrackNumber,
|
||||
arg.DiscNumber,
|
||||
arg.Year,
|
||||
arg.Genre,
|
||||
arg.Composer,
|
||||
arg.Lyrics,
|
||||
arg.Comment,
|
||||
arg.ID,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user