store

package
v0.0.0-...-64e8138 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPlaylistExists = errors.New("playlist already exists")

Functions

func Paginate

func Paginate[T any](db *gorm.DB, page, limit int, order string, preloads []string) ([]T, bool, error)

Paginate fetches a paginated list of items of type T. page: 1-based page number limit: number of items per page order: SQL order clause (e.g. "created_at desc") preloads: list of associations to preload

Types

type AlbumStore

type AlbumStore struct {
	// contains filtered or unexported fields
}

func NewAlbumStore

func NewAlbumStore(db *gorm.DB) *AlbumStore

func (*AlbumStore) CreateAlbum

func (as *AlbumStore) CreateAlbum(album *model.Album) (*model.Album, error)

func (*AlbumStore) DeleteAlbum

func (as *AlbumStore) DeleteAlbum(album *model.Album) error

func (*AlbumStore) GetAlbumByID

func (as *AlbumStore) GetAlbumByID(uuid uuid.UUID) (*model.Album, error)

func (*AlbumStore) GetAlbumsByIDs

func (as *AlbumStore) GetAlbumsByIDs(ids []uuid.UUID) ([]model.Album, error)

func (*AlbumStore) GetAlbumsByTitle

func (as *AlbumStore) GetAlbumsByTitle(title string) ([]model.Album, error)

func (*AlbumStore) GetAlbumsPaginated

func (as *AlbumStore) GetAlbumsPaginated(page, limit int) ([]model.Album, bool, error)

func (*AlbumStore) GetAllAlbums

func (as *AlbumStore) GetAllAlbums() ([]model.Album, error)

func (*AlbumStore) GetChangedAlbums

func (as *AlbumStore) GetChangedAlbums(since time.Time) ([]uuid.UUID, error)

func (*AlbumStore) GetDeletedAlbums

func (as *AlbumStore) GetDeletedAlbums(since time.Time) ([]uuid.UUID, error)

func (*AlbumStore) UpdateAlbum

func (as *AlbumStore) UpdateAlbum(album *model.Album) error

type ArtistStore

type ArtistStore struct {
	// contains filtered or unexported fields
}

func NewArtistStore

func NewArtistStore(db *gorm.DB) *ArtistStore

func (*ArtistStore) CreateArtist

func (as *ArtistStore) CreateArtist(artist *model.Artist) (*model.Artist, error)

func (*ArtistStore) CreateArtistIdentifier

func (as *ArtistStore) CreateArtistIdentifier(artist *model.Artist, identifier string) (*model.ArtistIdentifier, error)

func (*ArtistStore) DeleteArtist

func (as *ArtistStore) DeleteArtist(artist *model.Artist) error

func (*ArtistStore) GetAlbumsForArtist

func (as *ArtistStore) GetAlbumsForArtist(artistID uuid.UUID) ([]model.Album, error)

func (*ArtistStore) GetAllArtists

func (as *ArtistStore) GetAllArtists() ([]model.Artist, error)

func (*ArtistStore) GetArtistByID

func (as *ArtistStore) GetArtistByID(artistID uuid.UUID) (*model.Artist, error)

func (*ArtistStore) GetArtistByIdentifier

func (as *ArtistStore) GetArtistByIdentifier(identifier string) (*model.Artist, error)

func (*ArtistStore) GetArtistsByIDs

func (as *ArtistStore) GetArtistsByIDs(ids []uuid.UUID) ([]model.Artist, error)

func (*ArtistStore) GetArtistsPaginated

func (as *ArtistStore) GetArtistsPaginated(page, limit int) ([]model.Artist, bool, error)

func (*ArtistStore) GetChangedArtists

func (as *ArtistStore) GetChangedArtists(since time.Time) ([]uuid.UUID, error)

func (*ArtistStore) GetDeletedArtists

func (as *ArtistStore) GetDeletedArtists(since time.Time) ([]uuid.UUID, error)

func (*ArtistStore) UpdateArtist

func (as *ArtistStore) UpdateArtist(artist *model.Artist) error

type MBStore

type MBStore struct {
	// contains filtered or unexported fields
}

func NewMBStore

func NewMBStore(db *gorm.DB) *MBStore

func (*MBStore) GetRecordingBySongID

func (mb *MBStore) GetRecordingBySongID(mbSongID int, withArtistCredit bool) (*model.MBRecording, error)

func (*MBStore) SearchSongsByTitle

func (mb *MBStore) SearchSongsByTitle(ctx context.Context, title string, limit int) ([]model.MBRecording, error)

type MailStore

type MailStore struct {
	// contains filtered or unexported fields
}

func NewMailStore

func NewMailStore(db *gorm.DB) *MailStore

func (*MailStore) CreateRequestMail

func (ms *MailStore) CreateRequestMail(category, message string, userID uuid.UUID) (*model.RequestMail, error)

func (*MailStore) DeleteRequestMail

func (ms *MailStore) DeleteRequestMail(mailID uint) error

func (*MailStore) GetNextRequestMail

func (ms *MailStore) GetNextRequestMail() (*model.RequestMail, error)

func (*MailStore) GetRequestMails

func (ms *MailStore) GetRequestMails() []model.RequestMail

func (*MailStore) SetStatus

func (ms *MailStore) SetStatus(mailID uint, status int) error

type PlaylistStore

type PlaylistStore struct {
	// contains filtered or unexported fields
}

func NewPlaylistStore

func NewPlaylistStore(db *gorm.DB) *PlaylistStore

func (*PlaylistStore) AddSongToPlaylist

func (ps *PlaylistStore) AddSongToPlaylist(playlistID uuid.UUID, songID uuid.UUID) error

func (*PlaylistStore) BackfillPlaylistOrder

func (ps *PlaylistStore) BackfillPlaylistOrder() error

BackfillPlaylistOrder iterates through all existing Playlist-Song links If any link has an empty 'Order', it assigns sequential fractional keys ordered by CreatedAt.

func (*PlaylistStore) CreatePlaylist

func (ps *PlaylistStore) CreatePlaylist(playlist *model.Playlist) (model.Playlist, error)

func (*PlaylistStore) CreatePlaylistFolder

func (ps *PlaylistStore) CreatePlaylistFolder(folder *model.PlaylistFolder) (model.PlaylistFolder, error)

func (*PlaylistStore) DeletePlaylist

func (ps *PlaylistStore) DeletePlaylist(playlistID uuid.UUID, userID uuid.UUID, adminOverride bool) error

func (*PlaylistStore) DeletePlaylistFolder

func (ps *PlaylistStore) DeletePlaylistFolder(folderID uuid.UUID, userID uuid.UUID, adminOverride bool) error

func (*PlaylistStore) GetAllPlaylists

func (ps *PlaylistStore) GetAllPlaylists() ([]model.Playlist, error)

func (*PlaylistStore) GetChangedFolders

func (ps *PlaylistStore) GetChangedFolders(userID uuid.UUID, since time.Time) ([]uuid.UUID, error)

func (*PlaylistStore) GetChangedPlaylists

func (ps *PlaylistStore) GetChangedPlaylists(userID uuid.UUID, since time.Time) ([]uuid.UUID, error)

func (*PlaylistStore) GetDeletedFolders

func (ps *PlaylistStore) GetDeletedFolders(userID uuid.UUID, since time.Time) ([]uuid.UUID, error)

func (*PlaylistStore) GetDeletedPlaylists

func (ps *PlaylistStore) GetDeletedPlaylists(userID uuid.UUID, since time.Time) ([]uuid.UUID, error)

func (*PlaylistStore) GetFoldersByIDs

func (ps *PlaylistStore) GetFoldersByIDs(ids []uuid.UUID) ([]model.PlaylistFolder, error)

func (*PlaylistStore) GetLibrary

func (ps *PlaylistStore) GetLibrary(userID uuid.UUID) ([]model.PlaylistFolder, []model.Playlist, error)

func (*PlaylistStore) GetPlaylistByID

func (ps *PlaylistStore) GetPlaylistByID(playlistID uuid.UUID) (*model.Playlist, error)

func (*PlaylistStore) GetPlaylistSongs

func (ps *PlaylistStore) GetPlaylistSongs(playlistID uuid.UUID) ([]model.PlaylistSong, error)

func (*PlaylistStore) GetPlaylistsByIDs

func (ps *PlaylistStore) GetPlaylistsByIDs(ids []uuid.UUID) ([]model.Playlist, error)

func (*PlaylistStore) GetPlaylistsPaginated

func (ps *PlaylistStore) GetPlaylistsPaginated(page, limit int) ([]model.Playlist, bool, error)

func (*PlaylistStore) GetRootFolderID

func (ps *PlaylistStore) GetRootFolderID(userID uuid.UUID) (uuid.UUID, error)

func (*PlaylistStore) GetUserPlaylists

func (ps *PlaylistStore) GetUserPlaylists(userID uuid.UUID) ([]model.Playlist, error)

func (*PlaylistStore) IsFolderOwnedByUser

func (ps *PlaylistStore) IsFolderOwnedByUser(folderID uuid.UUID, userID uuid.UUID) bool

func (*PlaylistStore) MoveFolderToFolder

func (ps *PlaylistStore) MoveFolderToFolder(folderID uuid.UUID, targetParentID *uuid.UUID, userID uuid.UUID, adminOverride bool) error

func (*PlaylistStore) MovePlaylistToFolder

func (ps *PlaylistStore) MovePlaylistToFolder(playlistID uuid.UUID, targetFolderID uuid.UUID, userID uuid.UUID, adminOverride bool) error

func (*PlaylistStore) RemoveSongFromPlaylist

func (ps *PlaylistStore) RemoveSongFromPlaylist(playlistID uuid.UUID, songID uuid.UUID) error

func (*PlaylistStore) RenamePlaylist

func (ps *PlaylistStore) RenamePlaylist(playlistID uuid.UUID, userID uuid.UUID, newName string, adminOverride bool) error

func (*PlaylistStore) RenamePlaylistFolder

func (ps *PlaylistStore) RenamePlaylistFolder(folderID uuid.UUID, userID uuid.UUID, newName string, adminOverride bool) error

func (*PlaylistStore) UpdateSongOrder

func (ps *PlaylistStore) UpdateSongOrder(playlistID uuid.UUID, songID uuid.UUID, newOrder string) error

type SettingsStore

type SettingsStore struct {
	// contains filtered or unexported fields
}

func NewSettingsStore

func NewSettingsStore(db *gorm.DB) *SettingsStore

func (*SettingsStore) Get

func (s *SettingsStore) Get(key string) (string, error)

func (*SettingsStore) GetAll

func (s *SettingsStore) GetAll() (map[string]string, error)

func (*SettingsStore) IsSetupComplete

func (s *SettingsStore) IsSetupComplete() bool

func (*SettingsStore) Set

func (s *SettingsStore) Set(key, value string) error

type SongStore

type SongStore struct {
	// contains filtered or unexported fields
}

func NewSongStore

func NewSongStore(db *gorm.DB) *SongStore

func (*SongStore) CreateSong

func (ss *SongStore) CreateSong(song *model.Song) error

func (*SongStore) CreateSongFile

func (ss *SongStore) CreateSongFile(sf *model.SongFile) error

func (*SongStore) DeleteSong

func (ss *SongStore) DeleteSong(song *model.Song) error

func (*SongStore) DeleteSongFile

func (ss *SongStore) DeleteSongFile(id uuid.UUID) error

func (*SongStore) GetAllSongs

func (ss *SongStore) GetAllSongs() ([]model.Song, error)

func (*SongStore) GetChangedSongs

func (ss *SongStore) GetChangedSongs(since time.Time) ([]uuid.UUID, error)

func (*SongStore) GetDeletedSongs

func (ss *SongStore) GetDeletedSongs(since time.Time) ([]uuid.UUID, error)

func (*SongStore) GetFileByID

func (ss *SongStore) GetFileByID(fileID uuid.UUID) (*model.SongFile, error)

func (*SongStore) GetLatestSongs

func (ss *SongStore) GetLatestSongs() ([]model.Song, error)

func (*SongStore) GetSongByID

func (ss *SongStore) GetSongByID(id uuid.UUID) (*model.Song, error)

func (*SongStore) GetSongByMBID

func (ss *SongStore) GetSongByMBID(mbid int, withArtistCredit bool) (*model.Song, error)

func (*SongStore) GetSongByTitleAndAlbumID

func (ss *SongStore) GetSongByTitleAndAlbumID(title string, albumID uuid.UUID) (*model.Song, error)

func (*SongStore) GetSongFilesBySongID

func (ss *SongStore) GetSongFilesBySongID(songID uuid.UUID) ([]model.SongFile, error)

func (*SongStore) GetSongsByAlbumID

func (ss *SongStore) GetSongsByAlbumID(albumID uuid.UUID) ([]model.Song, error)

func (*SongStore) GetSongsByIDs

func (ss *SongStore) GetSongsByIDs(ids []uuid.UUID) ([]model.Song, error)

func (*SongStore) GetSongsPaginated

func (ss *SongStore) GetSongsPaginated(page, limit int) ([]model.Song, bool, error)

func (*SongStore) UpdateSong

func (ss *SongStore) UpdateSong(song *model.Song) error

func (*SongStore) UpdateSongArtists

func (ss *SongStore) UpdateSongArtists(song *model.Song, artists []model.Artist) error

type UserStore

type UserStore struct {
	// contains filtered or unexported fields
}

func NewUserStore

func NewUserStore(db *gorm.DB) *UserStore

func (*UserStore) CreateUser

func (us *UserStore) CreateUser(user *model.User) error

func (*UserStore) DeleteUser

func (us *UserStore) DeleteUser(user *model.User) error

func (*UserStore) GetUserByID

func (us *UserStore) GetUserByID(uuid uuid.UUID) (*model.User, error)

func (*UserStore) GetUserByUsername

func (us *UserStore) GetUserByUsername(username string) (*model.User, error)

func (*UserStore) PromoteUserToAdmin

func (us *UserStore) PromoteUserToAdmin(user *model.User) error

func (*UserStore) SetAdminStatus

func (us *UserStore) SetAdminStatus(user *model.User, isAdmin bool) error

func (*UserStore) UpdateUser

func (us *UserStore) UpdateUser(user *model.User) (*model.User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL