Documentation
¶
Index ¶
- type Sqlite
- func (s *Sqlite) AddArtistsToAlbum(ctx context.Context, opts db.AddArtistsToAlbumOpts) error
- func (s *Sqlite) AlbumsWithoutImages(ctx context.Context, from int32) ([]*models.Album, error)
- func (s *Sqlite) ArtistsWithoutImages(ctx context.Context, from int32) ([]*models.Artist, error)
- func (s *Sqlite) Close(_ context.Context)
- func (s *Sqlite) Count(query string, args ...any) (count int, err error)
- func (s *Sqlite) CountAlbums(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountArtists(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountListens(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountListensToItem(ctx context.Context, opts db.TimeListenedOpts) (int64, error)
- func (s *Sqlite) CountNewAlbums(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountNewArtists(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountNewTracks(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountTimeListened(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountTimeListenedToItem(ctx context.Context, opts db.TimeListenedOpts) (int64, error)
- func (s *Sqlite) CountTracks(ctx context.Context, timeframe db.Timeframe) (int64, error)
- func (s *Sqlite) CountUsers(ctx context.Context) (int64, error)
- func (s *Sqlite) DeleteAlbum(ctx context.Context, id int32) error
- func (s *Sqlite) DeleteAlbumAlias(ctx context.Context, id int32, alias string) error
- func (s *Sqlite) DeleteApiKey(ctx context.Context, id int32) error
- func (s *Sqlite) DeleteArtist(ctx context.Context, id int32) error
- func (s *Sqlite) DeleteArtistAlias(ctx context.Context, id int32, alias string) error
- func (s *Sqlite) DeleteListen(ctx context.Context, trackId int32, listenedAt time.Time) error
- func (s *Sqlite) DeleteSession(ctx context.Context, sessionId uuid.UUID) error
- func (s *Sqlite) DeleteTrack(ctx context.Context, id int32) error
- func (s *Sqlite) DeleteTrackAlias(ctx context.Context, id int32, alias string) error
- func (s *Sqlite) Exec(query string, args ...any) error
- func (s *Sqlite) GetAdminUser(ctx context.Context) (*models.User, error)
- func (s *Sqlite) GetAlbum(ctx context.Context, opts db.GetAlbumOpts) (*models.Album, error)
- func (s *Sqlite) GetAlbumWithNoMbzIDByTitles(ctx context.Context, artistId int32, titles []string) (*models.Album, error)
- func (s *Sqlite) GetAllAlbumAliases(ctx context.Context, id int32) ([]models.Alias, error)
- func (s *Sqlite) GetAllArtistAliases(ctx context.Context, id int32) ([]models.Alias, error)
- func (s *Sqlite) GetAllTrackAliases(ctx context.Context, id int32) ([]models.Alias, error)
- func (s *Sqlite) GetApiKeysByUserID(ctx context.Context, id int32) ([]models.ApiKey, error)
- func (s *Sqlite) GetArtist(ctx context.Context, opts db.GetArtistOpts) (*models.Artist, error)
- func (s *Sqlite) GetArtistsForAlbum(ctx context.Context, id int32) ([]*models.Artist, error)
- func (s *Sqlite) GetArtistsForTrack(ctx context.Context, id int32) ([]*models.Artist, error)
- func (s *Sqlite) GetExportPage(ctx context.Context, opts db.GetExportPageOpts) ([]*db.ExportItem, error)
- func (s *Sqlite) GetImageSource(ctx context.Context, image uuid.UUID) (string, error)
- func (s *Sqlite) GetInterest(ctx context.Context, opts db.GetInterestOpts) ([]db.InterestBucket, error)
- func (s *Sqlite) GetListenActivity(ctx context.Context, opts db.ListenActivityOpts) ([]db.ListenActivityItem, error)
- func (s *Sqlite) GetListensPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[*models.Listen], error)
- func (s *Sqlite) GetTopAlbumsPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[db.RankedItem[*models.Album]], error)
- func (s *Sqlite) GetTopArtistsPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[db.RankedItem[*models.Artist]], error)
- func (s *Sqlite) GetTopTracksPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[db.RankedItem[*models.Track]], error)
- func (s *Sqlite) GetTrack(ctx context.Context, opts db.GetTrackOpts) (*models.Track, error)
- func (s *Sqlite) GetTracksWithNoDurationButHaveMbzID(ctx context.Context, from int32) ([]*models.Track, error)
- func (s *Sqlite) GetUserByApiKey(ctx context.Context, key string) (*models.User, error)
- func (s *Sqlite) GetUserBySession(ctx context.Context, sessionId uuid.UUID) (*models.User, error)
- func (s *Sqlite) GetUserByUsername(ctx context.Context, username string) (*models.User, error)
- func (s *Sqlite) ImageHasAssociation(ctx context.Context, image uuid.UUID) (bool, error)
- func (s *Sqlite) MergeAlbums(ctx context.Context, fromId, toId int32, replaceImage bool) error
- func (s *Sqlite) MergeArtists(ctx context.Context, fromId, toId int32, replaceImage bool) error
- func (s *Sqlite) MergeTracks(ctx context.Context, fromId, toId int32) error
- func (s *Sqlite) Ping(ctx context.Context) error
- func (s *Sqlite) QueryRow(query string, args ...any) *sql.Row
- func (s *Sqlite) RefreshSession(ctx context.Context, sessionId uuid.UUID, expiresAt time.Time) error
- func (s *Sqlite) RowExists(query string, args ...any) (bool, error)
- func (s *Sqlite) SaveAlbum(ctx context.Context, opts db.SaveAlbumOpts) (*models.Album, error)
- func (s *Sqlite) SaveAlbumAliases(ctx context.Context, id int32, aliases []string, source string) error
- func (s *Sqlite) SaveApiKey(ctx context.Context, opts db.SaveApiKeyOpts) (*models.ApiKey, error)
- func (s *Sqlite) SaveArtist(ctx context.Context, opts db.SaveArtistOpts) (*models.Artist, error)
- func (s *Sqlite) SaveArtistAliases(ctx context.Context, id int32, aliases []string, source string) error
- func (s *Sqlite) SaveListen(ctx context.Context, opts db.SaveListenOpts) error
- func (s *Sqlite) SaveSession(ctx context.Context, userID int32, expiresAt time.Time, persistent bool) (*models.Session, error)
- func (s *Sqlite) SaveTrack(ctx context.Context, opts db.SaveTrackOpts) (*models.Track, error)
- func (s *Sqlite) SaveTrackAliases(ctx context.Context, id int32, aliases []string, source string) error
- func (s *Sqlite) SaveUser(ctx context.Context, opts db.SaveUserOpts) (*models.User, error)
- func (s *Sqlite) SearchAlbums(ctx context.Context, q string) ([]*models.Album, error)
- func (s *Sqlite) SearchArtists(ctx context.Context, q string) ([]*models.Artist, error)
- func (s *Sqlite) SearchTracks(ctx context.Context, q string) ([]*models.Track, error)
- func (s *Sqlite) SetPrimaryAlbumAlias(ctx context.Context, id int32, alias string) error
- func (s *Sqlite) SetPrimaryAlbumArtist(ctx context.Context, id int32, artistId int32, value bool) error
- func (s *Sqlite) SetPrimaryArtistAlias(ctx context.Context, id int32, alias string) error
- func (s *Sqlite) SetPrimaryTrackAlias(ctx context.Context, id int32, alias string) error
- func (s *Sqlite) SetPrimaryTrackArtist(ctx context.Context, id int32, artistId int32, value bool) error
- func (s *Sqlite) UpdateAlbum(ctx context.Context, opts db.UpdateAlbumOpts) error
- func (s *Sqlite) UpdateApiKeyLabel(ctx context.Context, opts db.UpdateApiKeyLabelOpts) error
- func (s *Sqlite) UpdateArtist(ctx context.Context, opts db.UpdateArtistOpts) error
- func (s *Sqlite) UpdateTrack(ctx context.Context, opts db.UpdateTrackOpts) error
- func (s *Sqlite) UpdateUser(ctx context.Context, opts db.UpdateUserOpts) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sqlite ¶
type Sqlite struct {
// contains filtered or unexported fields
}
func NewInMemory ¶
NewInMemory opens an isolated in-memory SQLite database and runs migrations. Each call produces an independent database, making it safe for parallel tests. Not intended for production use.
func (*Sqlite) AddArtistsToAlbum ¶
func (*Sqlite) AlbumsWithoutImages ¶
func (*Sqlite) ArtistsWithoutImages ¶
func (*Sqlite) CountAlbums ¶
func (*Sqlite) CountArtists ¶
func (*Sqlite) CountListens ¶
func (*Sqlite) CountListensToItem ¶
func (*Sqlite) CountNewAlbums ¶
func (*Sqlite) CountNewArtists ¶
func (*Sqlite) CountNewTracks ¶
func (*Sqlite) CountTimeListened ¶
func (*Sqlite) CountTimeListenedToItem ¶
func (*Sqlite) CountTracks ¶
func (*Sqlite) DeleteAlbumAlias ¶
func (*Sqlite) DeleteArtistAlias ¶
func (*Sqlite) DeleteListen ¶
func (*Sqlite) DeleteSession ¶
func (*Sqlite) DeleteTrackAlias ¶
func (*Sqlite) GetAdminUser ¶
func (*Sqlite) GetAlbumWithNoMbzIDByTitles ¶
func (*Sqlite) GetAllAlbumAliases ¶
func (*Sqlite) GetAllArtistAliases ¶
func (*Sqlite) GetAllTrackAliases ¶
func (*Sqlite) GetApiKeysByUserID ¶
func (*Sqlite) GetArtistsForAlbum ¶
func (*Sqlite) GetArtistsForTrack ¶
func (*Sqlite) GetExportPage ¶
func (s *Sqlite) GetExportPage(ctx context.Context, opts db.GetExportPageOpts) ([]*db.ExportItem, error)
func (*Sqlite) GetImageSource ¶
func (*Sqlite) GetInterest ¶
func (s *Sqlite) GetInterest(ctx context.Context, opts db.GetInterestOpts) ([]db.InterestBucket, error)
GetInterest computes N evenly-spaced listen-count buckets spanning the entity's entire listen history. The PG implementation used generate_series + EXTRACT(EPOCH); here we fetch all timestamps in Go and do the bucketing in memory.
func (*Sqlite) GetListenActivity ¶
func (s *Sqlite) GetListenActivity(ctx context.Context, opts db.ListenActivityOpts) ([]db.ListenActivityItem, error)
func (*Sqlite) GetListensPaginated ¶
func (s *Sqlite) GetListensPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[*models.Listen], error)
func (*Sqlite) GetTopAlbumsPaginated ¶
func (s *Sqlite) GetTopAlbumsPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[db.RankedItem[*models.Album]], error)
func (*Sqlite) GetTopArtistsPaginated ¶
func (s *Sqlite) GetTopArtistsPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[db.RankedItem[*models.Artist]], error)
func (*Sqlite) GetTopTracksPaginated ¶
func (s *Sqlite) GetTopTracksPaginated(ctx context.Context, opts db.GetItemsOpts) (*db.PaginatedResponse[db.RankedItem[*models.Track]], error)
func (*Sqlite) GetTracksWithNoDurationButHaveMbzID ¶
func (*Sqlite) GetUserByApiKey ¶
func (*Sqlite) GetUserBySession ¶
func (*Sqlite) GetUserByUsername ¶
func (*Sqlite) ImageHasAssociation ¶
func (*Sqlite) MergeAlbums ¶
func (*Sqlite) MergeArtists ¶
func (*Sqlite) MergeTracks ¶
func (*Sqlite) QueryRow ¶
Exposes db.QueryRow. Only used for testing. Not part of the DB interface this package implements.
func (*Sqlite) RefreshSession ¶
func (*Sqlite) RowExists ¶
Not part of the DB interface this package implements. Only used for testing.
func (*Sqlite) SaveAlbumAliases ¶
func (*Sqlite) SaveApiKey ¶
func (*Sqlite) SaveArtist ¶
func (*Sqlite) SaveArtistAliases ¶
func (*Sqlite) SaveListen ¶
func (*Sqlite) SaveSession ¶
func (*Sqlite) SaveTrackAliases ¶
func (*Sqlite) SearchAlbums ¶
func (*Sqlite) SearchArtists ¶
func (*Sqlite) SearchTracks ¶
func (*Sqlite) SetPrimaryAlbumAlias ¶
func (*Sqlite) SetPrimaryAlbumArtist ¶
func (*Sqlite) SetPrimaryArtistAlias ¶
func (*Sqlite) SetPrimaryTrackAlias ¶
func (*Sqlite) SetPrimaryTrackArtist ¶
func (*Sqlite) UpdateAlbum ¶
func (*Sqlite) UpdateApiKeyLabel ¶
func (*Sqlite) UpdateArtist ¶
func (*Sqlite) UpdateTrack ¶
func (*Sqlite) UpdateUser ¶
Click to show internal directories.
Click to hide internal directories.