-libraries tab now opens a library manager -choose library directory, manually soft scan and rescan -batched db queues -mp3 header-based duration extraction
137 lines
3.0 KiB
Go
137 lines
3.0 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: cover_art.sql
|
|
|
|
package sqlcgen
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
const createCoverArt = `-- name: CreateCoverArt :one
|
|
INSERT INTO cover_art (is_embedded, file_path, mime_type) VALUES (?, ?, ?)
|
|
RETURNING id, is_embedded, file_path, mime_type
|
|
`
|
|
|
|
type CreateCoverArtParams struct {
|
|
IsEmbedded bool
|
|
FilePath string
|
|
MimeType string
|
|
}
|
|
|
|
func (q *Queries) CreateCoverArt(ctx context.Context, arg CreateCoverArtParams) (CoverArt, error) {
|
|
row := q.db.QueryRowContext(ctx, createCoverArt, arg.IsEmbedded, arg.FilePath, arg.MimeType)
|
|
var i CoverArt
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.IsEmbedded,
|
|
&i.FilePath,
|
|
&i.MimeType,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const deleteAllCoverArt = `-- name: DeleteAllCoverArt :exec
|
|
DELETE FROM cover_art
|
|
`
|
|
|
|
func (q *Queries) DeleteAllCoverArt(ctx context.Context) error {
|
|
_, err := q.db.ExecContext(ctx, deleteAllCoverArt)
|
|
return 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, mime_type 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.MimeType,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getCoverArtByPath = `-- name: GetCoverArtByPath :one
|
|
SELECT id, is_embedded, file_path, mime_type FROM cover_art
|
|
WHERE file_path = ? LIMIT 1
|
|
`
|
|
|
|
func (q *Queries) GetCoverArtByPath(ctx context.Context, filePath string) (CoverArt, error) {
|
|
row := q.db.QueryRowContext(ctx, getCoverArtByPath, filePath)
|
|
var i CoverArt
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.IsEmbedded,
|
|
&i.FilePath,
|
|
&i.MimeType,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateCoverArt = `-- name: UpdateCoverArt :exec
|
|
UPDATE cover_art
|
|
SET is_embedded = ?, file_path = ?, mime_type = ?
|
|
WHERE id = ?
|
|
`
|
|
|
|
type UpdateCoverArtParams struct {
|
|
IsEmbedded bool
|
|
FilePath string
|
|
MimeType string
|
|
ID int64
|
|
}
|
|
|
|
func (q *Queries) UpdateCoverArt(ctx context.Context, arg UpdateCoverArtParams) error {
|
|
_, err := q.db.ExecContext(ctx, updateCoverArt,
|
|
arg.IsEmbedded,
|
|
arg.FilePath,
|
|
arg.MimeType,
|
|
arg.ID,
|
|
)
|
|
return err
|
|
}
|
|
|
|
const upsertCoverArt = `-- name: UpsertCoverArt :one
|
|
INSERT INTO cover_art (is_embedded, file_path, mime_type)
|
|
VALUES (?, ?, ?)
|
|
ON CONFLICT(file_path) DO UPDATE SET
|
|
is_embedded = excluded.is_embedded,
|
|
mime_type = excluded.mime_type
|
|
RETURNING id, is_embedded, file_path, mime_type
|
|
`
|
|
|
|
type UpsertCoverArtParams struct {
|
|
IsEmbedded bool
|
|
FilePath string
|
|
MimeType string
|
|
}
|
|
|
|
func (q *Queries) UpsertCoverArt(ctx context.Context, arg UpsertCoverArtParams) (CoverArt, error) {
|
|
row := q.db.QueryRowContext(ctx, upsertCoverArt, arg.IsEmbedded, arg.FilePath, arg.MimeType)
|
|
var i CoverArt
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.IsEmbedded,
|
|
&i.FilePath,
|
|
&i.MimeType,
|
|
)
|
|
return i, err
|
|
}
|