repos

package
v0.0.0-...-3e3cd93 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptPassword

func DecryptPassword(encryptedPassword []byte) (string, error)

func EncryptPassword

func EncryptPassword(password string) ([]byte, error)

func FallbackGain

func FallbackGain() float64

func SetFallbackGain

func SetFallbackGain(gain float64)

Types

type Album

type Album struct {
	ID             string     `db:"id"`
	Name           string     `db:"name"`
	Created        time.Time  `db:"created"`
	Updated        time.Time  `db:"updated"`
	Year           *int       `db:"year"`
	RecordLabels   StringList `db:"record_labels"`
	MusicBrainzID  *string    `db:"music_brainz_id"`
	ReleaseMBID    *string    `db:"release_mbid"`
	ReleaseTypes   StringList `db:"release_types"`
	IsCompilation  *bool      `db:"is_compilation"`
	ReplayGain     *float64   `db:"replay_gain"`
	ReplayGainPeak *float64   `db:"replay_gain_peak"`
}

type AlbumAnnotations

type AlbumAnnotations struct {
	Starred       *time.Time `db:"starred"`
	UserRating    *int       `db:"user_rating"`
	AverageRating *float64   `db:"avg_rating"`
}

type AlbumArtistConnection

type AlbumArtistConnection struct {
	AlbumID  string `db:"album_id"`
	ArtistID string `db:"artist_id"`
}

type AlbumInfo

type AlbumInfo struct {
	AlbumID       string     `db:"id"`
	Updated       *time.Time `db:"info_updated"`
	Description   *string    `db:"description"`
	LastFMURL     *string    `db:"lastfm_url"`
	LastFMMBID    *string    `db:"lastfm_mbid"`
	MusicBrainzID *string    `db:"music_brainz_id"`
}

type AlbumLists

type AlbumLists struct {
	Genres  []string    `db:"-"`
	Artists []ArtistRef `db:"-"`
}

type AlbumPlayInfo

type AlbumPlayInfo struct {
	PlayCount  int        `db:"play_count"`
	LastPlayed *time.Time `db:"last_played"`
}

type AlbumRepository

type AlbumRepository interface {
	Create(ctx context.Context, params CreateAlbumParams) (string, error)
	Update(ctx context.Context, id string, params UpdateAlbumParams) error
	DeleteIfNoTracks(ctx context.Context) error

	FindByID(ctx context.Context, id string, include IncludeAlbumInfo) (*CompleteAlbum, error)
	FindAll(ctx context.Context, params FindAlbumParams, include IncludeAlbumInfo) ([]*CompleteAlbum, error)
	FindBySearch(ctx context.Context, query string, paginate Paginate, include IncludeAlbumInfo) ([]*CompleteAlbum, error)
	FindStarred(ctx context.Context, paginate Paginate, include IncludeAlbumInfo) ([]*CompleteAlbum, error)

	GetTracks(ctx context.Context, id string, include IncludeSongInfo) ([]*CompleteSong, error)

	Star(ctx context.Context, user, albumID string) error
	UnStar(ctx context.Context, user, albumID string) error

	SetRating(ctx context.Context, user, albumID string, rating int) error
	RemoveRating(ctx context.Context, user, albumID string) error

	GetInfo(ctx context.Context, albumID string, after time.Time) (*AlbumInfo, error)
	SetInfo(ctx context.Context, albumID string, params SetAlbumInfo) error

	GetAllArtistConnections(ctx context.Context) ([]AlbumArtistConnection, error)
	RemoveAllArtistConnections(ctx context.Context) error
	CreateArtistConnections(ctx context.Context, connections []AlbumArtistConnection) error
}

type AlbumTrackInfo

type AlbumTrackInfo struct {
	TrackCount int        `db:"track_count"`
	Duration   DurationMS `db:"duration_ms"`
}

type Artist

type Artist struct {
	ID            string    `db:"id"`
	Name          string    `db:"name"`
	Created       time.Time `db:"created"`
	Updated       time.Time `db:"updated"`
	MusicBrainzID *string   `db:"music_brainz_id"`
}

type ArtistAlbumInfo

type ArtistAlbumInfo struct {
	AlbumCount int `db:"album_count"`
}

type ArtistAnnotations

type ArtistAnnotations struct {
	Starred       *time.Time `db:"starred"`
	UserRating    *int       `db:"user_rating"`
	AverageRating *float64   `db:"avg_rating"`
}

type ArtistInfo

type ArtistInfo struct {
	ArtistID      string     `db:"id"`
	Updated       *time.Time `db:"info_updated"`
	Biography     *string    `db:"biography"`
	LastFMURL     *string    `db:"lastfm_url"`
	LastFMMBID    *string    `db:"lastfm_mbid"`
	MusicBrainzID *string    `db:"music_brainz_id"`
}

type ArtistRef

type ArtistRef struct {
	ID            string  `db:"id"`
	Name          string  `db:"name"`
	MusicBrainzID *string `db:"music_brainz_id"`
}

type ArtistRepository

type ArtistRepository interface {
	Create(ctx context.Context, params CreateArtistParams) (string, error)
	CreateIfNotExistsByName(ctx context.Context, params []CreateArtistParams) error
	Update(ctx context.Context, id string, params UpdateArtistParams) error
	DeleteIfNoAlbumsAndNoSongs(ctx context.Context) error

	FindOrCreateIDsByNames(ctx context.Context, names []string) ([]string, error)

	FindByID(ctx context.Context, id string, include IncludeArtistInfo) (*CompleteArtist, error)
	FindByNames(ctx context.Context, names []string, include IncludeArtistInfo) ([]*CompleteArtist, error)
	FindAll(ctx context.Context, params FindArtistsParams, include IncludeArtistInfo) ([]*CompleteArtist, error)
	FindBySearch(ctx context.Context, query string, onlyAlbumArtists bool, paginate Paginate, include IncludeArtistInfo) ([]*CompleteArtist, error)
	FindStarred(ctx context.Context, paginate Paginate, include IncludeArtistInfo) ([]*CompleteArtist, error)

	GetAlbums(ctx context.Context, id string, include IncludeAlbumInfo) ([]*CompleteAlbum, error)

	Star(ctx context.Context, user, artistID string) error
	UnStar(ctx context.Context, user, artistID string) error

	SetRating(ctx context.Context, user, artistID string, rating int) error
	RemoveRating(ctx context.Context, user, artistID string) error

	GetInfo(ctx context.Context, artistID string, after time.Time) (*ArtistInfo, error)
	SetInfo(ctx context.Context, artistID string, params SetArtistInfo) error
}

type CompleteArtist

type CompleteArtist struct {
	Artist
	*ArtistAnnotations
	*ArtistAlbumInfo
}

type CompletePlaylist

type CompletePlaylist struct {
	Playlist
	*PlaylistTrackInfo
}

type CompleteSong

type CompleteSong struct {
	Song
	*SongAlbumInfo
	*SongAnnotations
	*SongPlayInfo
	*SongLists
}

type CreateAlbumParams

type CreateAlbumParams struct {
	Name           string
	Year           *int
	RecordLabels   StringList
	MusicBrainzID  *string
	ReleaseMBID    *string
	ReleaseTypes   StringList
	IsCompilation  *bool
	ReplayGain     *float64
	ReplayGainPeak *float64
}

type CreateArtistParams

type CreateArtistParams struct {
	Name          string
	MusicBrainzID *string
}

type CreateInternetRadioStationParams

type CreateInternetRadioStationParams struct {
	Name        string
	StreamURL   string
	HomepageURL *string
}

type CreatePlaylistParams

type CreatePlaylistParams struct {
	Name    string
	Owner   string
	Public  bool
	Comment *string
}

type CreateScrobbleParams

type CreateScrobbleParams struct {
	User                    string
	SongID                  string
	AlbumID                 *string
	Time                    time.Time
	SongDuration            DurationMS
	Duration                NullDurationMS
	SubmittedToListenBrainz bool
	NowPlaying              bool
}

type CreateSongParams

type CreateSongParams struct {
	ID             *string
	Path           string
	AlbumID        *string
	Title          string
	Track          *int
	Year           *int
	Size           int64
	ContentType    string
	Duration       DurationMS
	BitRate        int
	SamplingRate   int
	ChannelCount   int
	Disc           *int
	BPM            *int
	MusicBrainzID  *string
	ReplayGain     *float64
	ReplayGainPeak *float64
	Lyrics         *string
}

type DB

type DB interface {
	Tx
	Transaction(ctx context.Context, fn func(tx Tx) error) error

	NewTransaction(ctx context.Context) (Transaction, error)

	Close() error
}

type DurationMS

type DurationMS time.Duration

func NewDurationMS

func NewDurationMS(millis int64) DurationMS

func NewDurationMSFromStd

func NewDurationMSFromStd(d time.Duration) DurationMS

func (DurationMS) Millis

func (nt DurationMS) Millis() int64

func (*DurationMS) Scan

func (nt *DurationMS) Scan(value any) error

func (DurationMS) Seconds

func (nt DurationMS) Seconds() int

func (DurationMS) ToStd

func (nt DurationMS) ToStd() time.Duration

func (DurationMS) Value

func (nt DurationMS) Value() (driver.Value, error)

type Error

type Error struct {
	Message string
	Type    ErrorType
	DBErr   error
}

func NewError

func NewError(message string, errType ErrorType, innerErr error) Error

func (Error) Error

func (e Error) Error() string

func (Error) Is

func (e Error) Is(target error) bool

func (Error) Unwrap

func (e Error) Unwrap() error

type ErrorType

type ErrorType string
const (
	ErrNotFound          ErrorType = "not found"
	ErrTooMany           ErrorType = "got multiple rows, expected one"
	ErrNestedTransaction ErrorType = "nested transactions not allowed"
	ErrGeneral           ErrorType = "general"
	ErrInvalidParams     ErrorType = "invalid parameters"
)

func (ErrorType) Error

func (e ErrorType) Error() string

type FindAlbumParams

type FindAlbumParams struct {
	SortBy   FindAlbumSortBy
	FromYear *int
	ToYear   *int
	Genres   []string
	Paginate Paginate
}

type FindAlbumSortBy

type FindAlbumSortBy int
const (
	FindAlbumSortByName FindAlbumSortBy = iota
	FindAlbumSortByCreated
	FindAlbumSortByRating
	FindAlbumSortByStarred
	FindAlbumSortRandom
	FindAlbumSortByYear
	FindAlbumSortByFrequent
	FindAlbumSortByRecent
)

type FindAlbumsByNameWithArtistMatchCountResult

type FindAlbumsByNameWithArtistMatchCountResult struct {
	AlbumID            string  `db:"id"`
	AlbumMusicBrainzID *string `db:"music_brainz_id"`
	ArtistMatches      int     `db:"artist_matches"`
}

type FindArtistsParams

type FindArtistsParams struct {
	OnlyAlbumArtists bool
	UpdatedAfter     time.Time
}

type Genre

type Genre struct {
	Name string `db:"name"`
}

type GenreRepository

type GenreRepository interface {
	CreateIfNotExists(ctx context.Context, names []string) error
	DeleteIfNoSongs(ctx context.Context) error
	FindAllWithCounts(ctx context.Context) ([]*GenreWithCounts, error)
}

type GenreWithCounts

type GenreWithCounts struct {
	Genre
	AlbumCount int `db:"album_count"`
	SongCount  int `db:"song_count"`
}

type IncludeAlbumInfo

type IncludeAlbumInfo struct {
	TrackInfo bool

	User        string
	Annotations bool
	PlayInfo    bool

	Genres  bool
	Artists bool
}

func IncludeAlbumInfoBare

func IncludeAlbumInfoBare() IncludeAlbumInfo

func IncludeAlbumInfoFull

func IncludeAlbumInfoFull(user string) IncludeAlbumInfo

type IncludeArtistInfo

type IncludeArtistInfo struct {
	AlbumInfo   bool
	Annotations bool
	User        string
}

func IncludeArtistInfoBare

func IncludeArtistInfoBare() IncludeArtistInfo

func IncludeArtistInfoFull

func IncludeArtistInfoFull(user string) IncludeArtistInfo

type IncludePlaylistInfo

type IncludePlaylistInfo struct {
	TrackInfo bool
}

func IncludePlaylistInfoBare

func IncludePlaylistInfoBare() IncludePlaylistInfo

func IncludePlaylistInfoFull

func IncludePlaylistInfoFull() IncludePlaylistInfo

type IncludeSongInfo

type IncludeSongInfo struct {
	Album bool

	User        string
	Annotations bool
	PlayInfo    bool

	Lists bool
}

func IncludeSongInfoAlbum

func IncludeSongInfoAlbum() IncludeSongInfo

func IncludeSongInfoBare

func IncludeSongInfoBare() IncludeSongInfo

func IncludeSongInfoFull

func IncludeSongInfoFull(user string) IncludeSongInfo

type InternetRadioStation

type InternetRadioStation struct {
	ID          string    `db:"id"`
	Name        string    `db:"name"`
	StreamURL   string    `db:"stream_url"`
	Created     time.Time `db:"created"`
	Updated     time.Time `db:"updated"`
	User        string    `db:"user_name"`
	HomepageURL *string   `db:"homepage_url"`
}

type InternetRadioStationRepository

type InternetRadioStationRepository interface {
	FindAll(ctx context.Context, user string) ([]*InternetRadioStation, error)
	Create(ctx context.Context, user string, params CreateInternetRadioStationParams) (*InternetRadioStation, error)
	Update(ctx context.Context, user, id string, params UpdateInternetRadioStationParams) error
	Delete(ctx context.Context, user, id string) error
}

type NowPlayingSong

type NowPlayingSong struct {
	*CompleteSong
	User string    `db:"user_name"`
	Time time.Time `db:"time"`
}

type NullDurationMS

type NullDurationMS struct {
	Duration DurationMS
	Valid    bool
}

func (*NullDurationMS) Scan

func (nt *NullDurationMS) Scan(value any) error

func (NullDurationMS) Value

func (nt NullDurationMS) Value() (driver.Value, error)

type Optional

type Optional[T any] struct {
	// contains filtered or unexported fields
}

func NewOptional

func NewOptional[T any](value T, hasValue bool) Optional[T]

func NewOptionalEmpty

func NewOptionalEmpty[T any]() Optional[T]

func NewOptionalFull

func NewOptionalFull[T any](value T) Optional[T]

func (Optional[T]) Get

func (o Optional[T]) Get() any

func (Optional[T]) HasValue

func (o Optional[T]) HasValue() bool

type OptionalGetter

type OptionalGetter interface {
	HasValue() bool
	Get() any
}

type Paginate

type Paginate struct {
	Offset int
	Limit  *int
}

func (Paginate) Apply

func (p Paginate) Apply(q *bqb.Query)

type Playlist

type Playlist struct {
	ID      string    `db:"id"`
	Name    string    `db:"name"`
	Created time.Time `db:"created"`
	Updated time.Time `db:"updated"`
	Owner   string    `db:"owner"`
	Public  bool      `db:"public"`
	Comment *string   `db:"comment"`
}

type PlaylistRepository

type PlaylistRepository interface {
	Create(ctx context.Context, params CreatePlaylistParams) (*Playlist, error)
	Update(ctx context.Context, user, id string, params UpdatePlaylistParams) error

	FindByID(ctx context.Context, user, id string, include IncludePlaylistInfo) (*CompletePlaylist, error)
	FindAll(ctx context.Context, user string, include IncludePlaylistInfo) ([]*CompletePlaylist, error)

	GetTracks(ctx context.Context, id string, include IncludeSongInfo) ([]*CompleteSong, error)
	AddTracks(ctx context.Context, id string, songIDs []string) error
	RemoveTracks(ctx context.Context, id string, trackNumbers []int) error
	ClearTracks(ctx context.Context, id string) error
	SetTracks(ctx context.Context, id string, songIDs []string) error

	Delete(ctx context.Context, user, id string) error
}

type PlaylistTrackInfo

type PlaylistTrackInfo struct {
	TrackCount int        `db:"track_count"`
	Duration   DurationMS `db:"duration_ms"`
}

type Scrobble

type Scrobble struct {
	User                    string         `db:"user_name"`
	SongID                  string         `db:"song_id"`
	AlbumID                 *string        `db:"album_id"`
	Time                    time.Time      `db:"time"`
	SongDuration            DurationMS     `db:"song_duration_ms"`
	Duration                NullDurationMS `db:"duration_ms"`
	SubmittedToListenBrainz bool           `db:"submitted_to_listenbrainz"`
	NowPlaying              bool           `db:"now_playing"`
}

type ScrobbleRepository

type ScrobbleRepository interface {
	CreateMultiple(ctx context.Context, params []CreateScrobbleParams) error
	FindPossibleConflicts(ctx context.Context, user string, songIDs []string, times []time.Time) ([]*Scrobble, error)

	DeleteNowPlaying(ctx context.Context, user string) error
	GetNowPlaying(ctx context.Context, user string) (*Scrobble, error)
	GetNowPlayingSongs(ctx context.Context, include IncludeSongInfo) ([]*NowPlayingSong, error)

	FindUnsubmittedLBScrobbles(ctx context.Context) ([]*Scrobble, error)
	SetLBSubmittedByUsers(ctx context.Context, users []string) error

	GetDurationSum(ctx context.Context, user string, start, end time.Time) (DurationMS, error)
	GetDistinctSongCount(ctx context.Context, user string, start, end time.Time) (int, error)
	GetDistinctAlbumCount(ctx context.Context, user string, start, end time.Time) (int, error)
	GetDistinctArtistCount(ctx context.Context, user string, start, end time.Time) (int, error)
	GetTopSongsByDuration(ctx context.Context, user string, start, end time.Time, offset, limit int, include IncludeSongInfo) ([]*ScrobbleTopSong, error)
}

type ScrobbleTopSong

type ScrobbleTopSong struct {
	*CompleteSong
	TotalDuration DurationMS `db:"total_duration_ms"`
}

type SetAlbumInfo

type SetAlbumInfo struct {
	Description *string
	LastFMURL   *string
	LastFMMBID  *string
}

type SetArtistInfo

type SetArtistInfo struct {
	Biography  *string
	LastFMURL  *string
	LastFMMBID *string
}

type Song

type Song struct {
	ID             string     `db:"id"`
	Path           string     `db:"path"`
	AlbumID        *string    `db:"album_id"`
	Title          string     `db:"title"`
	Track          *int       `db:"track"`
	Year           *int       `db:"year"`
	Size           int64      `db:"size"`
	ContentType    string     `db:"content_type"`
	Duration       DurationMS `db:"duration_ms"`
	BitRate        int        `db:"bit_rate"`
	SamplingRate   int        `db:"sampling_rate"`
	ChannelCount   int        `db:"channel_count"`
	Disc           *int       `db:"disc_number"`
	Created        time.Time  `db:"created"`
	Updated        time.Time  `db:"updated"`
	BPM            *int       `db:"bpm"`
	MusicBrainzID  *string    `db:"music_brainz_id"`
	ReplayGain     *float64   `db:"replay_gain"`
	ReplayGainPeak *float64   `db:"replay_gain_peak"`
	Lyrics         *string    `db:"lyrics"`
}

type SongAlbumInfo

type SongAlbumInfo struct {
	AlbumName           *string  `db:"album_name"`
	AlbumReplayGain     *float64 `db:"album_replay_gain"`
	AlbumReplayGainPeak *float64 `db:"album_replay_gain_peak"`
	AlbumMusicBrainzID  *string  `db:"album_music_brainz_id"`
	AlbumReleaseMBID    *string  `db:"album_release_mbid"`
}

type SongAnnotations

type SongAnnotations struct {
	Starred       *time.Time `db:"starred"`
	UserRating    *int       `db:"user_rating"`
	AverageRating *float64   `db:"avg_rating"`
}

type SongArtistConnection

type SongArtistConnection struct {
	SongID   string `db:"song_id"`
	ArtistID string `db:"artist_id"`
}

type SongFindBySearchParams

type SongFindBySearchParams struct {
	Query    string
	Paginate Paginate
}

type SongFindRandomParams

type SongFindRandomParams struct {
	FromYear *int
	ToYear   *int
	Genres   []string
	Limit    int
}

type SongGenreConnection

type SongGenreConnection struct {
	SongID string `db:"song_id"`
	Genre  string `db:"genre_name"`
}

type SongLists

type SongLists struct {
	Genres       []string    `db:"-"`
	Artists      []ArtistRef `db:"-"`
	AlbumArtists []ArtistRef `db:"-"`
}

type SongPlayInfo

type SongPlayInfo struct {
	PlayCount  int        `db:"play_count"`
	LastPlayed *time.Time `db:"last_played"`
}

type SongRepository

type SongRepository interface {
	FindByID(ctx context.Context, id string, include IncludeSongInfo) (*CompleteSong, error)
	FindByIDs(ctx context.Context, ids []string, include IncludeSongInfo) ([]*CompleteSong, error)
	FindByMusicBrainzID(ctx context.Context, mbid string, include IncludeSongInfo) ([]*CompleteSong, error)
	FindByPath(ctx context.Context, path string, include IncludeSongInfo) (*CompleteSong, error)
	FindRandom(ctx context.Context, params SongFindRandomParams, include IncludeSongInfo) ([]*CompleteSong, error)
	FindBySearch(ctx context.Context, params SongFindBySearchParams, include IncludeSongInfo) ([]*CompleteSong, error)
	FindStarred(ctx context.Context, paginate Paginate, include IncludeSongInfo) ([]*CompleteSong, error)
	FindByGenre(ctx context.Context, genre string, paginate Paginate, include IncludeSongInfo) ([]*CompleteSong, error)
	FindByTitle(ctx context.Context, title string, include IncludeSongInfo) ([]*CompleteSong, error)
	FindAllByPathOrMBID(ctx context.Context, paths []string, mbids []string, include IncludeSongInfo) ([]*CompleteSong, error)
	FindNonExistentIDs(ctx context.Context, ids []string) ([]string, error)

	FindPaths(ctx context.Context, updatedBefore time.Time, paginate Paginate) ([]string, error)
	DeleteByPaths(ctx context.Context, paths []string) error

	GetStreamInfo(ctx context.Context, id string) (*SongStreamInfo, error)

	Create(ctx context.Context, params CreateSongParams) (*Song, error)
	Update(ctx context.Context, id string, params UpdateSongParams) error
	CreateAll(ctx context.Context, params []CreateSongParams) error
	TryUpdateAll(ctx context.Context, params []UpdateSongAllParams) (int, error)

	DeleteLastUpdatedBefore(ctx context.Context, before time.Time) error

	DeleteArtistConnections(ctx context.Context, songIDs []string) error
	CreateArtistConnections(ctx context.Context, connections []SongArtistConnection) error

	DeleteGenreConnections(ctx context.Context, songIDs []string) error
	CreateGenreConnections(ctx context.Context, connections []SongGenreConnection) error

	Star(ctx context.Context, user, songID string) error
	StarMultiple(ctx context.Context, user string, songID []string) (int, error)
	UnStar(ctx context.Context, user, songID string) error

	SetRating(ctx context.Context, user, songID string, rating int) error
	RemoveRating(ctx context.Context, user, songID string) error

	SetLBFeedbackUpdated(ctx context.Context, user string, params []SongSetLBFeedbackUpdatedParams) error
	RemoveLBFeedbackUpdated(ctx context.Context, user string, songIDs []string) error
	FindLBFeedbackUpdatedSongIDsInMBIDListNotStarred(ctx context.Context, user string, mbids []string) ([]string, error)
	DeleteLBFeedbackUpdatedStarsNotInMBIDList(ctx context.Context, user string, mbids []string) (int, error)
	FindNotLBUpdatedSongs(ctx context.Context, user string, include IncludeSongInfo) ([]*CompleteSong, error)

	Count(ctx context.Context) (int, error)
	GetMedianReplayGain(ctx context.Context) (float64, error)
}

type SongSetLBFeedbackUpdatedParams

type SongSetLBFeedbackUpdatedParams struct {
	SongID string
	MBID   string
}

type SongStreamInfo

type SongStreamInfo struct {
	Path         string     `db:"path"`
	BitRate      int        `db:"bit_rate"`
	ContentType  string     `db:"content_type"`
	Duration     DurationMS `db:"duration_ms"`
	ChannelCount int        `db:"channel_count"`
}

type StringList

type StringList []string

func (*StringList) Scan

func (nt *StringList) Scan(value interface{}) error

func (StringList) Value

func (nt StringList) Value() (driver.Value, error)

type SystemRepository

type SystemRepository interface {
	InstanceID(ctx context.Context) (string, error)
	LastScan(ctx context.Context) (time.Time, error)
	SetLastScan(ctx context.Context, lastScan time.Time) error
}

type Transaction

type Transaction interface {
	Tx
	Commit() error
	Rollback() error
}

type Tx

type Tx interface {
	User() UserRepository
	System() SystemRepository
	Song() SongRepository
	Scrobble() ScrobbleRepository
	Album() AlbumRepository
	Artist() ArtistRepository
	Genre() GenreRepository
	Playlist() PlaylistRepository
	InternetRadioStation() InternetRadioStationRepository
}

type UpdateAlbumParams

type UpdateAlbumParams struct {
	Name           Optional[string]
	Year           Optional[*int]
	RecordLabels   Optional[StringList]
	MusicBrainzID  Optional[*string]
	ReleaseMBID    Optional[*string]
	ReleaseTypes   Optional[StringList]
	IsCompilation  Optional[*bool]
	ReplayGain     Optional[*float64]
	ReplayGainPeak Optional[*float64]
}

type UpdateArtistParams

type UpdateArtistParams struct {
	Name          Optional[string]
	MusicBrainzID Optional[*string]
}

type UpdateInternetRadioStationParams

type UpdateInternetRadioStationParams struct {
	Name        Optional[string]
	StreamURL   Optional[string]
	HomepageURL Optional[*string]
}

type UpdatePlaylistParams

type UpdatePlaylistParams struct {
	Name    Optional[string]
	Public  Optional[bool]
	Comment Optional[*string]
}

type UpdateSongAllParams

type UpdateSongAllParams struct {
	ID             string
	Path           string
	AlbumID        *string
	Title          string
	Track          *int
	Year           *int
	Size           int64
	ContentType    string
	Duration       DurationMS
	BitRate        int
	SamplingRate   int
	ChannelCount   int
	Disc           *int
	BPM            *int
	MusicBrainzID  *string
	ReplayGain     *float64
	ReplayGainPeak *float64
	Lyrics         *string
}

type UpdateSongParams

type UpdateSongParams struct {
	Path           Optional[string]
	AlbumID        Optional[*string]
	Title          Optional[string]
	Track          Optional[*int]
	Year           Optional[*int]
	Size           Optional[int64]
	ContentType    Optional[string]
	Duration       Optional[DurationMS]
	BitRate        Optional[int]
	SamplingRate   Optional[int]
	ChannelCount   Optional[int]
	Disc           Optional[*int]
	BPM            Optional[*int]
	MusicBrainzID  Optional[*string]
	ReplayGain     Optional[*float64]
	ReplayGainPeak Optional[*float64]
	Lyrics         Optional[*string]
}

type User

type User struct {
	Name              string `db:"name"`
	EncryptedPassword []byte `db:"encrypted_password"`

	ListenBrainzUsername       *string `db:"listenbrainz_username"`
	EncryptedListenBrainzToken []byte  `db:"encrypted_listenbrainz_token"`
}

type UserRepository

type UserRepository interface {
	Create(ctx context.Context, name, password string) error
	UpdateListenBrainzConnection(ctx context.Context, user string, lbUsername, lbToken *string) error
	FindAll(ctx context.Context) ([]*User, error)
	FindByName(ctx context.Context, name string) (*User, error)
	DeleteByName(ctx context.Context, name string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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