Documentation ¶
Overview ¶
Package query loads songs and tags from datastore.
Index ¶
- func CleanSong(s *db.Song, id int64)
- func FlushCache(ctx context.Context, t cache.Type) error
- func FlushCacheForUpdate(ctx context.Context, ut UpdateTypes) error
- func Songs(ctx context.Context, query *SongQuery, flags SongsFlags) ([]*db.Song, error)
- func Tags(ctx context.Context, requireCache bool) ([]string, error)
- type SongQuery
- type SongsFlags
- type UpdateTypes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanSong ¶
CleanSong prepares s to be returned in results. This is exported so it can be called by tests in other packages.
func FlushCache ¶
FlushCache deletes all cached queries and tags from t.
func FlushCacheForUpdate ¶
func FlushCacheForUpdate(ctx context.Context, ut UpdateTypes) error
FlushCacheForUpdate deletes the appropriate cached queries for an update of the supplied types.
Types ¶
type SongQuery ¶
type SongQuery struct { Artist string // Song.Artist Title string // Song.Title Album string // Song.Album AlbumID string // Song.AlbumID Filename string // song.Filename Keywords []string // Song.Keywords Rating int // Song.Rating (0 if unspecified; use Unrated for 0) MinRating int // Song.Rating (0 if unspecified) MaxRating int // Song.Rating (0 if unspecified) Unrated bool // Song.Rating is 0 MaxPlays int64 // Song.NumPlays (-1 if unspecified) MinFirstStartTime time.Time // Song.FirstStartTime MaxLastStartTime time.Time // Song.LastStartTime Track int64 // Song.Track Disc int64 // Song.Disc MinDate time.Time // Song.Date MaxDate time.Time // Song.Date Tags []string // present in Song.Tags NotTags []string // not present in Song.Tags Shuffle bool // randomize results set/order OrderByLastStartTime bool // order by Song.LastStartTime }
SongQuery describes a query returning a list of Songs.
type SongsFlags ¶
type SongsFlags uint32
SongsFlags is a bitfield controlling the behavior of the Songs function.
const ( // CacheOnly indicates that empty results should be returned if the query's results aren't // already cached. CacheOnly SongsFlags = 1 << iota // ForceFallback indicates that the fallback mode that tries to avoid requiring composite // indexes should be used instead of the normal mode. ForceFallback // NoFallback indicates that the fallback mode should never be used. NoFallback )
type UpdateTypes ¶
type UpdateTypes uint32
UpdateTypes is a bitfield describing what was changed by an update. It is used for invalidating cached data.
const ( MetadataUpdate UpdateTypes = 1 << iota // song metadata RatingUpdate TagsUpdate PlaysUpdate )
Click to show internal directories.
Click to hide internal directories.