Koito/internal/repository/alias.sql.go
Gabe Farrell 36f984a1a2
Pre-release version v0.0.14 (#96)
* add dev branch container to workflow

* correctly set the default range of ActivityGrid

* fix: set name/short_name to koito (#61)

* fix dev container push workflow

* fix: race condition with using getComputedStyle primary color for dynamic activity grid darkening (#76)

* Fix race condition with using getComputedStyle primary color for dynamic activity grid darkening

Instead just use the color from the current theme directly. Tested works on initial load and theme changes.
Fixes https://github.com/gabehf/Koito/issues/75

* Rework theme provider to provide the actual Theme object throughtout the app, in addition to the name
Split name out of the Theme struct to simplify custom theme saving/reading

* fix: set first artist listed as primary by default (#81)

* feat: add server-side configuration with default theme (#90)

* docs: add example for usage of the main listenbrainz instance (#71)

* docs: add example for usage of the main listenbrainz instance

* Update scrobbler.md

---------

Co-authored-by: Gabe Farrell <90876006+gabehf@users.noreply.github.com>

* feat: add server-side cfg and default theme

* fix: repair custom theme

---------

Co-authored-by: m0d3rnX <jesper@posteo.de>

* docs: add default theme cfg option to docs

* feat: add ability to manually scrobble track (#91)

* feat: add button to manually scrobble from ui

* fix: ensure timestamp is in the past, log fix

* test: add integration test

* feat: add first listened to dates for media items (#92)

* fix: ensure error checks for ErrNoRows

* feat: add now playing endpoint and ui (#93)

* wip

* feat: add now playing

* fix: set default theme when config is not set

* feat: fetch images from subsonic server (#94)

* fix: useQuery instead of useEffect for now playing

* feat: custom artist separator regex (#95)

* Fix race condition with using getComputedStyle primary color for dynamic activity grid darkening

Instead just use the color from the current theme directly. Tested works on initial load and theme changes.
Fixes https://github.com/gabehf/Koito/issues/75

* Rework theme provider to provide the actual Theme object throughtout the app, in addition to the name
Split name out of the Theme struct to simplify custom theme saving/reading

* feat: add server-side configuration with default theme (#90)

* docs: add example for usage of the main listenbrainz instance (#71)

* docs: add example for usage of the main listenbrainz instance

* Update scrobbler.md

---------

Co-authored-by: Gabe Farrell <90876006+gabehf@users.noreply.github.com>

* feat: add server-side cfg and default theme

* fix: repair custom theme

---------

Co-authored-by: m0d3rnX <jesper@posteo.de>

* fix: rebase errors

---------

Co-authored-by: pet <128837728+againstpetra@users.noreply.github.com>
Co-authored-by: mlandry <mike.landry@gmail.com>
Co-authored-by: m0d3rnX <jesper@posteo.de>
2025-11-19 20:26:56 -05:00

316 lines
7.4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: alias.sql
package repository
import (
"context"
)
const deleteArtistAlias = `-- name: DeleteArtistAlias :exec
DELETE FROM artist_aliases
WHERE artist_id = $1
AND alias = $2
AND is_primary = false
`
type DeleteArtistAliasParams struct {
ArtistID int32
Alias string
}
func (q *Queries) DeleteArtistAlias(ctx context.Context, arg DeleteArtistAliasParams) error {
_, err := q.db.Exec(ctx, deleteArtistAlias, arg.ArtistID, arg.Alias)
return err
}
const deleteReleaseAlias = `-- name: DeleteReleaseAlias :exec
DELETE FROM release_aliases
WHERE release_id = $1
AND alias = $2
AND is_primary = false
`
type DeleteReleaseAliasParams struct {
ReleaseID int32
Alias string
}
func (q *Queries) DeleteReleaseAlias(ctx context.Context, arg DeleteReleaseAliasParams) error {
_, err := q.db.Exec(ctx, deleteReleaseAlias, arg.ReleaseID, arg.Alias)
return err
}
const deleteTrackAlias = `-- name: DeleteTrackAlias :exec
DELETE FROM track_aliases
WHERE track_id = $1
AND alias = $2
AND is_primary = false
`
type DeleteTrackAliasParams struct {
TrackID int32
Alias string
}
func (q *Queries) DeleteTrackAlias(ctx context.Context, arg DeleteTrackAliasParams) error {
_, err := q.db.Exec(ctx, deleteTrackAlias, arg.TrackID, arg.Alias)
return err
}
const getAllArtistAliases = `-- name: GetAllArtistAliases :many
SELECT artist_id, alias, source, is_primary FROM artist_aliases
WHERE artist_id = $1 ORDER BY is_primary DESC
`
func (q *Queries) GetAllArtistAliases(ctx context.Context, artistID int32) ([]ArtistAlias, error) {
rows, err := q.db.Query(ctx, getAllArtistAliases, artistID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []ArtistAlias
for rows.Next() {
var i ArtistAlias
if err := rows.Scan(
&i.ArtistID,
&i.Alias,
&i.Source,
&i.IsPrimary,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const getAllReleaseAliases = `-- name: GetAllReleaseAliases :many
SELECT release_id, alias, source, is_primary FROM release_aliases
WHERE release_id = $1 ORDER BY is_primary DESC
`
func (q *Queries) GetAllReleaseAliases(ctx context.Context, releaseID int32) ([]ReleaseAlias, error) {
rows, err := q.db.Query(ctx, getAllReleaseAliases, releaseID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []ReleaseAlias
for rows.Next() {
var i ReleaseAlias
if err := rows.Scan(
&i.ReleaseID,
&i.Alias,
&i.Source,
&i.IsPrimary,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const getAllTrackAliases = `-- name: GetAllTrackAliases :many
SELECT track_id, alias, is_primary, source FROM track_aliases
WHERE track_id = $1 ORDER BY is_primary DESC
`
func (q *Queries) GetAllTrackAliases(ctx context.Context, trackID int32) ([]TrackAlias, error) {
rows, err := q.db.Query(ctx, getAllTrackAliases, trackID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []TrackAlias
for rows.Next() {
var i TrackAlias
if err := rows.Scan(
&i.TrackID,
&i.Alias,
&i.IsPrimary,
&i.Source,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const getArtistAlias = `-- name: GetArtistAlias :one
SELECT artist_id, alias, source, is_primary FROM artist_aliases
WHERE alias = $1 LIMIT 1
`
func (q *Queries) GetArtistAlias(ctx context.Context, alias string) (ArtistAlias, error) {
row := q.db.QueryRow(ctx, getArtistAlias, alias)
var i ArtistAlias
err := row.Scan(
&i.ArtistID,
&i.Alias,
&i.Source,
&i.IsPrimary,
)
return i, err
}
const getReleaseAlias = `-- name: GetReleaseAlias :one
SELECT release_id, alias, source, is_primary FROM release_aliases
WHERE alias = $1 LIMIT 1
`
func (q *Queries) GetReleaseAlias(ctx context.Context, alias string) (ReleaseAlias, error) {
row := q.db.QueryRow(ctx, getReleaseAlias, alias)
var i ReleaseAlias
err := row.Scan(
&i.ReleaseID,
&i.Alias,
&i.Source,
&i.IsPrimary,
)
return i, err
}
const getTrackAlias = `-- name: GetTrackAlias :one
SELECT track_id, alias, is_primary, source FROM track_aliases
WHERE alias = $1 LIMIT 1
`
func (q *Queries) GetTrackAlias(ctx context.Context, alias string) (TrackAlias, error) {
row := q.db.QueryRow(ctx, getTrackAlias, alias)
var i TrackAlias
err := row.Scan(
&i.TrackID,
&i.Alias,
&i.IsPrimary,
&i.Source,
)
return i, err
}
const insertArtistAlias = `-- name: InsertArtistAlias :exec
INSERT INTO artist_aliases (artist_id, alias, source, is_primary)
VALUES ($1, $2, $3, $4)
ON CONFLICT DO NOTHING
`
type InsertArtistAliasParams struct {
ArtistID int32
Alias string
Source string
IsPrimary bool
}
func (q *Queries) InsertArtistAlias(ctx context.Context, arg InsertArtistAliasParams) error {
_, err := q.db.Exec(ctx, insertArtistAlias,
arg.ArtistID,
arg.Alias,
arg.Source,
arg.IsPrimary,
)
return err
}
const insertReleaseAlias = `-- name: InsertReleaseAlias :exec
INSERT INTO release_aliases (release_id, alias, source, is_primary)
VALUES ($1, $2, $3, $4)
ON CONFLICT DO NOTHING
`
type InsertReleaseAliasParams struct {
ReleaseID int32
Alias string
Source string
IsPrimary bool
}
func (q *Queries) InsertReleaseAlias(ctx context.Context, arg InsertReleaseAliasParams) error {
_, err := q.db.Exec(ctx, insertReleaseAlias,
arg.ReleaseID,
arg.Alias,
arg.Source,
arg.IsPrimary,
)
return err
}
const insertTrackAlias = `-- name: InsertTrackAlias :exec
INSERT INTO track_aliases (track_id, alias, source, is_primary)
VALUES ($1, $2, $3, $4)
ON CONFLICT DO NOTHING
`
type InsertTrackAliasParams struct {
TrackID int32
Alias string
Source string
IsPrimary bool
}
func (q *Queries) InsertTrackAlias(ctx context.Context, arg InsertTrackAliasParams) error {
_, err := q.db.Exec(ctx, insertTrackAlias,
arg.TrackID,
arg.Alias,
arg.Source,
arg.IsPrimary,
)
return err
}
const setArtistAliasPrimaryStatus = `-- name: SetArtistAliasPrimaryStatus :exec
UPDATE artist_aliases SET is_primary = $1 WHERE artist_id = $2 AND alias = $3
`
type SetArtistAliasPrimaryStatusParams struct {
IsPrimary bool
ArtistID int32
Alias string
}
func (q *Queries) SetArtistAliasPrimaryStatus(ctx context.Context, arg SetArtistAliasPrimaryStatusParams) error {
_, err := q.db.Exec(ctx, setArtistAliasPrimaryStatus, arg.IsPrimary, arg.ArtistID, arg.Alias)
return err
}
const setReleaseAliasPrimaryStatus = `-- name: SetReleaseAliasPrimaryStatus :exec
UPDATE release_aliases SET is_primary = $1 WHERE release_id = $2 AND alias = $3
`
type SetReleaseAliasPrimaryStatusParams struct {
IsPrimary bool
ReleaseID int32
Alias string
}
func (q *Queries) SetReleaseAliasPrimaryStatus(ctx context.Context, arg SetReleaseAliasPrimaryStatusParams) error {
_, err := q.db.Exec(ctx, setReleaseAliasPrimaryStatus, arg.IsPrimary, arg.ReleaseID, arg.Alias)
return err
}
const setTrackAliasPrimaryStatus = `-- name: SetTrackAliasPrimaryStatus :exec
UPDATE track_aliases SET is_primary = $1 WHERE track_id = $2 AND alias = $3
`
type SetTrackAliasPrimaryStatusParams struct {
IsPrimary bool
TrackID int32
Alias string
}
func (q *Queries) SetTrackAliasPrimaryStatus(ctx context.Context, arg SetTrackAliasPrimaryStatusParams) error {
_, err := q.db.Exec(ctx, setTrackAliasPrimaryStatus, arg.IsPrimary, arg.TrackID, arg.Alias)
return err
}