Documentation ¶
Index ¶
- Variables
- func AlbumQuery() *goqu.SelectDataset
- func ApiTokenQuery() *goqu.SelectDataset
- func ArtistQuery() *goqu.SelectDataset
- func FeaturingArtistsQuery(table, idColName string) *goqu.SelectDataset
- func InvalidFilter(err error) error
- func InvalidSort(err error) error
- func PlaylistQuery() *goqu.SelectDataset
- func RunMigrateUp(db *Database) error
- func TagQuery() *goqu.SelectDataset
- func TrackMapNameToId(typ string, name string) string
- func TrackQuery() *goqu.SelectDataset
- func UserQuery() *goqu.SelectDataset
- func UserSettingsQuery() *goqu.SelectDataset
- type Album
- type AlbumChanges
- type ApiToken
- type Artist
- type ArtistChanges
- type ArtistSearch
- type Connection
- type CreateAlbumParams
- type CreateApiTokenParams
- type CreateArtistParams
- type CreatePlaylistParams
- type CreateTaglistParams
- type CreateTrackParams
- type CreateUserParams
- type Database
- func (db *Database) AddFeaturingArtistToAlbum(ctx context.Context, albumId, artistId string) error
- func (db *Database) AddFeaturingArtistToTrack(ctx context.Context, trackId, artistId string) error
- func (db *Database) AddItemToPlaylist(ctx context.Context, playlistId, trackId string) error
- func (db *Database) AddTagToAlbum(ctx context.Context, tagSlug, albumId string) error
- func (db *Database) AddTagToArtist(ctx context.Context, tagSlug, artistId string) error
- func (db *Database) AddTagToTrack(ctx context.Context, tagSlug, trackId string) error
- func (db *Database) Begin() (*Database, *sqlx.Tx, error)
- func (db *Database) CreateAlbum(ctx context.Context, params CreateAlbumParams) (Album, error)
- func (db *Database) CreateApiToken(ctx context.Context, params CreateApiTokenParams) (ApiToken, error)
- func (db *Database) CreateArtist(ctx context.Context, params CreateArtistParams) (Artist, error)
- func (db *Database) CreatePlaylist(ctx context.Context, params CreatePlaylistParams) (Playlist, error)
- func (db *Database) CreateTag(ctx context.Context, slug string) error
- func (db *Database) CreateTaglist(ctx context.Context, params CreateTaglistParams) (Taglist, error)
- func (db *Database) CreateTrack(ctx context.Context, params CreateTrackParams) (string, error)
- func (db *Database) CreateUser(ctx context.Context, params CreateUserParams) (User, error)
- func (db *Database) Exec(ctx context.Context, s ToSQL) (sql.Result, error)
- func (db *Database) Get(dest any, s ToSQL) error
- func (db *Database) GetAlbumById(ctx context.Context, id string) (Album, error)
- func (db *Database) GetAlbumByName(ctx context.Context, name string) (Album, error)
- func (db *Database) GetAlbumsByArtist(ctx context.Context, artistId string) ([]Album, error)
- func (db *Database) GetAllAlbums(ctx context.Context, filterStr string, sortStr string) ([]Album, error)
- func (db *Database) GetAllApiTokensForUser(ctx context.Context, userId string) ([]ApiToken, error)
- func (db *Database) GetAllArtists(ctx context.Context, filterStr, sortStr string) ([]Artist, error)
- func (db *Database) GetAllTags(ctx context.Context) ([]Tag, error)
- func (db *Database) GetAllTracks(ctx context.Context, filterStr, sortStr string) ([]Track, error)
- func (db *Database) GetAllUsers(ctx context.Context) ([]User, error)
- func (db *Database) GetApiTokenById(ctx context.Context, id string) (ApiToken, error)
- func (db *Database) GetArtistById(ctx context.Context, id string) (Artist, error)
- func (db *Database) GetArtistByName(ctx context.Context, name string) (Artist, error)
- func (db *Database) GetPagedTracks(ctx context.Context, opts FetchOption) ([]Track, types.Page, error)
- func (db *Database) GetPlaylistById(ctx context.Context, id string) (Playlist, error)
- func (db *Database) GetPlaylistItems(ctx context.Context, playlistId string) ([]PlaylistItem, error)
- func (db *Database) GetPlaylistTracks(ctx context.Context, playlistId string) ([]Track, error)
- func (db *Database) GetPlaylistsByUser(ctx context.Context, userId string) ([]Playlist, error)
- func (db *Database) GetTagBySlug(ctx context.Context, slug string) (Tag, error)
- func (db *Database) GetTaglistById(ctx context.Context, id string) (Taglist, error)
- func (db *Database) GetTaglistByUser(ctx context.Context, userId string) ([]Taglist, error)
- func (db *Database) GetTrackById(ctx context.Context, id string) (Track, error)
- func (db *Database) GetTrackByNameAndAlbum(ctx context.Context, name string, albumId string) (Track, error)
- func (db *Database) GetTracksByAlbum(ctx context.Context, albumId string) ([]Track, error)
- func (db *Database) GetUserById(ctx context.Context, id string) (User, error)
- func (db *Database) GetUserByUsername(ctx context.Context, username string) (User, error)
- func (db *Database) GetUserSettingsById(ctx context.Context, id string) (UserSettings, error)
- func (db *Database) InitializeSearch() error
- func (db *Database) Query(ctx context.Context, s ToSQL) (*sql.Rows, error)
- func (db *Database) QueryRow(ctx context.Context, s ToSQL) (*sql.Row, error)
- func (db *Database) RefillSearchTables(ctx context.Context) error
- func (db *Database) RemoveAlbum(ctx context.Context, id string) error
- func (db *Database) RemoveAlbumTracks(ctx context.Context, albumId string) error
- func (db *Database) RemoveAllAlbumFeaturingArtists(ctx context.Context, albumId string) error
- func (db *Database) RemoveAllTagsFromAlbum(ctx context.Context, albumId string) error
- func (db *Database) RemoveAllTagsFromArtist(ctx context.Context, artistId string) error
- func (db *Database) RemoveAllTagsFromTrack(ctx context.Context, trackId string) error
- func (db *Database) RemoveAllTrackFeaturingArtists(ctx context.Context, trackId string) error
- func (db *Database) RemoveApiToken(ctx context.Context, id string) error
- func (db *Database) RemovePlaylistItem(ctx context.Context, playlistId, trackId string) error
- func (db *Database) RemoveTaglist(ctx context.Context, id string) error
- func (db *Database) RemoveTrack(ctx context.Context, id string) error
- func (db *Database) RunMigrateDown() error
- func (db *Database) RunMigrateUp() error
- func (db *Database) SearchAlbums(searchQuery string) ([]Album, error)
- func (db *Database) SearchArtists(searchQuery string) ([]Artist, error)
- func (db *Database) SearchTracks(searchQuery string) ([]Track, error)
- func (db *Database) Select(dest any, s ToSQL) error
- func (db *Database) UpdateAlbum(ctx context.Context, id string, changes AlbumChanges) error
- func (db *Database) UpdateArtist(ctx context.Context, id string, changes ArtistChanges) error
- func (db *Database) UpdateTaglist(ctx context.Context, id string, changes TaglistChanges) error
- func (db *Database) UpdateTrack(ctx context.Context, id string, changes TrackChanges) error
- func (db *Database) UpdateUser(ctx context.Context, id string, changes UserChanges) error
- func (db *Database) UpdateUserSettings(ctx context.Context, settings UserSettings) error
- type FeaturingArtist
- type FeaturingArtists
- type FetchOption
- type Playlist
- type PlaylistItem
- type Tag
- type Taglist
- type TaglistChanges
- type ToSQL
- type Track
- type TrackChanges
- type TrackSearch
- type User
- type UserChanges
- type UserSettings
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidFilter = errors.New("invalid filter")
TODO(patrik): Move
View Source
var ErrInvalidSort = errors.New("invalid sort")
View Source
var ErrItemAlreadyExists = errors.New("database: item already exists")
View Source
var ErrItemNotFound = errors.New("database: item not found")
Functions ¶
func AlbumQuery ¶ added in v0.16.2
func AlbumQuery() *goqu.SelectDataset
func ApiTokenQuery ¶ added in v0.18.0
func ApiTokenQuery() *goqu.SelectDataset
func ArtistQuery ¶ added in v0.16.2
func ArtistQuery() *goqu.SelectDataset
func FeaturingArtistsQuery ¶ added in v0.18.0
func FeaturingArtistsQuery(table, idColName string) *goqu.SelectDataset
TODO(patrik): Move
func InvalidFilter ¶ added in v0.18.0
func InvalidSort ¶ added in v0.18.0
func PlaylistQuery ¶ added in v0.18.0
func PlaylistQuery() *goqu.SelectDataset
func RunMigrateUp ¶ added in v0.14.0
func TrackMapNameToId ¶ added in v0.11.0
func TrackQuery ¶ added in v0.13.0
func TrackQuery() *goqu.SelectDataset
TODO(patrik): Use goqu.T more
func UserSettingsQuery ¶ added in v0.18.0
func UserSettingsQuery() *goqu.SelectDataset
Types ¶
type Album ¶
type Album struct { Id string `db:"id"` Name string `db:"name"` OtherName sql.NullString `db:"other_name"` ArtistId string `db:"artist_id"` CoverArt sql.NullString `db:"cover_art"` Year sql.NullInt64 `db:"year"` ArtistName string `db:"artist_name"` ArtistOtherName sql.NullString `db:"artist_other_name"` Created int64 `db:"created"` Updated int64 `db:"updated"` Tags sql.NullString `db:"tags"` FeaturingArtists FeaturingArtists `db:"featuring_artists"` }
type AlbumChanges ¶ added in v0.7.0
type Artist ¶
type Artist struct { Id string `db:"id"` Name string `db:"name"` OtherName sql.NullString `db:"other_name"` Picture sql.NullString `db:"picture"` Created int64 `db:"created"` Updated int64 `db:"updated"` Tags sql.NullString `db:"tags"` }
type ArtistChanges ¶ added in v0.7.0
type ArtistSearch ¶ added in v0.18.0
type Connection ¶ added in v0.10.0
type CreateAlbumParams ¶
type CreateApiTokenParams ¶ added in v0.18.0
type CreateArtistParams ¶
type CreateArtistParams struct { Id string Name string OtherName sql.NullString Picture sql.NullString Created int64 Updated int64 }
type CreatePlaylistParams ¶ added in v0.10.0
type CreateTaglistParams ¶ added in v0.18.0
type CreateTrackParams ¶
type CreateUserParams ¶ added in v0.18.0
type Database ¶ added in v0.6.0
type Database struct { NewRawConn *sqlx.DB RawConn *sql.DB Conn Connection }
func (*Database) AddFeaturingArtistToAlbum ¶ added in v0.18.0
TODO(patrik): Generalize
func (*Database) AddFeaturingArtistToTrack ¶ added in v0.18.0
TODO(patrik): Generalize
func (*Database) AddItemToPlaylist ¶ added in v0.18.0
func (*Database) AddTagToAlbum ¶ added in v0.18.0
TODO(patrik): Generalize TODO(patrik): Rename to AddAlbumTag, same with track
func (*Database) AddTagToArtist ¶ added in v0.18.0
TODO(patrik): Generalize TODO(patrik): Rename to AddArtistTag, same with track
func (*Database) AddTagToTrack ¶ added in v0.8.0
func (*Database) CreateAlbum ¶ added in v0.6.0
func (*Database) CreateApiToken ¶ added in v0.18.0
func (*Database) CreateArtist ¶ added in v0.6.0
func (*Database) CreatePlaylist ¶ added in v0.10.0
func (*Database) CreateTaglist ¶ added in v0.18.0
func (*Database) CreateTrack ¶ added in v0.6.0
func (*Database) CreateUser ¶ added in v0.10.0
func (*Database) GetAlbumById ¶ added in v0.6.0
func (*Database) GetAlbumByName ¶ added in v0.10.0
func (*Database) GetAlbumsByArtist ¶ added in v0.6.0
func (*Database) GetAllAlbums ¶ added in v0.6.0
func (*Database) GetAllApiTokensForUser ¶ added in v0.18.0
func (*Database) GetAllArtists ¶ added in v0.6.0
func (*Database) GetAllTags ¶ added in v0.9.0
func (*Database) GetAllTracks ¶ added in v0.6.0
func (*Database) GetAllUsers ¶ added in v0.12.0
func (*Database) GetApiTokenById ¶ added in v0.18.0
func (*Database) GetArtistById ¶ added in v0.6.0
func (*Database) GetArtistByName ¶ added in v0.8.0
func (*Database) GetPagedTracks ¶ added in v0.18.0
func (*Database) GetPlaylistById ¶ added in v0.10.0
func (*Database) GetPlaylistItems ¶ added in v0.10.0
func (*Database) GetPlaylistTracks ¶ added in v0.16.2
func (*Database) GetPlaylistsByUser ¶ added in v0.10.0
func (*Database) GetTagBySlug ¶ added in v0.16.2
func (*Database) GetTaglistById ¶ added in v0.18.0
func (*Database) GetTaglistByUser ¶ added in v0.18.0
func (*Database) GetTrackById ¶ added in v0.6.0
func (*Database) GetTrackByNameAndAlbum ¶ added in v0.11.0
func (*Database) GetTracksByAlbum ¶ added in v0.6.0
func (*Database) GetUserById ¶ added in v0.10.0
func (*Database) GetUserByUsername ¶ added in v0.10.0
func (*Database) GetUserSettingsById ¶ added in v0.18.0
func (*Database) InitializeSearch ¶ added in v0.18.0
func (*Database) RefillSearchTables ¶ added in v0.18.0
func (*Database) RemoveAlbum ¶ added in v0.16.2
func (*Database) RemoveAlbumTracks ¶ added in v0.16.2
func (*Database) RemoveAllAlbumFeaturingArtists ¶ added in v0.18.0
TODO(patrik): Generalize
func (*Database) RemoveAllTagsFromAlbum ¶ added in v0.18.0
TODO(patrik): Generalize TODO(patrik): Rename to RemoveAllAlbumTags, same with track
func (*Database) RemoveAllTagsFromArtist ¶ added in v0.18.0
TODO(patrik): Generalize TODO(patrik): Rename to RemoveAllArtistTags, same with track
func (*Database) RemoveAllTagsFromTrack ¶ added in v0.16.2
func (*Database) RemoveAllTrackFeaturingArtists ¶ added in v0.18.0
TODO(patrik): Generalize
func (*Database) RemoveApiToken ¶ added in v0.18.0
func (*Database) RemovePlaylistItem ¶ added in v0.18.0
func (*Database) RemoveTaglist ¶ added in v0.18.0
func (*Database) RemoveTrack ¶ added in v0.16.2
func (*Database) RunMigrateDown ¶ added in v0.16.2
func (*Database) RunMigrateUp ¶ added in v0.16.2
func (*Database) SearchAlbums ¶ added in v0.18.0
func (*Database) SearchArtists ¶ added in v0.18.0
func (*Database) SearchTracks ¶ added in v0.18.0
func (*Database) UpdateAlbum ¶ added in v0.7.0
func (*Database) UpdateArtist ¶ added in v0.7.0
func (*Database) UpdateTaglist ¶ added in v0.18.0
func (*Database) UpdateTrack ¶ added in v0.6.0
func (*Database) UpdateUser ¶ added in v0.17.0
func (*Database) UpdateUserSettings ¶ added in v0.18.0
func (db *Database) UpdateUserSettings(ctx context.Context, settings UserSettings) error
type FeaturingArtist ¶ added in v0.18.0
type FeaturingArtists ¶ added in v0.18.0
type FeaturingArtists []FeaturingArtist
func (*FeaturingArtists) Scan ¶ added in v0.18.0
func (v *FeaturingArtists) Scan(value any) error
type FetchOption ¶ added in v0.18.0
TODO(patrik): Move
type PlaylistItem ¶ added in v0.10.0
type TaglistChanges ¶ added in v0.18.0
type Track ¶
type Track struct { Id string `db:"id"` Name string `db:"name"` OtherName sql.NullString `db:"other_name"` AlbumId string `db:"album_id"` ArtistId string `db:"artist_id"` Duration int64 `db:"duration"` Number sql.NullInt64 `db:"number"` Year sql.NullInt64 `db:"year"` OriginalFilename string `db:"original_filename"` MobileFilename string `db:"mobile_filename"` AlbumName string `db:"album_name"` AlbumOtherName sql.NullString `db:"album_other_name"` AlbumCoverArt sql.NullString `db:"album_cover_art"` ArtistName string `db:"artist_name"` ArtistOtherName sql.NullString `db:"artist_other_name"` Created int64 `db:"created"` Updated int64 `db:"updated"` Tags sql.NullString `db:"tags"` FeaturingArtists FeaturingArtists `db:"featuring_artists"` }
type TrackChanges ¶ added in v0.7.0
type TrackChanges struct { Name types.Change[string] OtherName types.Change[sql.NullString] AlbumId types.Change[string] ArtistId types.Change[string] Duration types.Change[int64] Number types.Change[sql.NullInt64] Year types.Change[sql.NullInt64] OriginalFilename types.Change[string] MobileFilename types.Change[string] Created types.Change[int64] }
type TrackSearch ¶ added in v0.18.0
type User ¶ added in v0.10.0
type User struct { Id string `db:"id"` Username string `db:"username"` Password string `db:"password"` Role string `db:"role"` Created int64 `db:"created"` Updated int64 `db:"updated"` // NOTE(patrik): This needs to match UserSettings DisplayName sql.NullString `db:"display_name"` QuickPlaylist sql.NullString `db:"quick_playlist"` }
func (User) ToUserSettings ¶ added in v0.18.0
func (u User) ToUserSettings() UserSettings
type UserChanges ¶ added in v0.17.0
type UserSettings ¶ added in v0.18.0
type UserSettings struct { Id string `db:"id"` DisplayName sql.NullString `db:"display_name"` QuickPlaylist sql.NullString `db:"quick_playlist"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.