Documentation
¶
Overview ¶
Package query loads songs and tags from datastore.
Index ¶
- 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) (results any, numMatched int, err 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 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.
func Songs ¶
func Songs(ctx context.Context, query *SongQuery, flags SongsFlags) (results any, numMatched int, err error)
Songs executes the supplied query and returns matching songs. results is a []string if query.OnlyIDs is true or []*common.Song otherwise.
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
SongID int64 // song.SongID (0 if unspecified)
SHA1 string // song.SHA1
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
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
OnlyIDs bool // return song IDs instead of songs
MaxResults int // maximum songs to return (0 for default)
}
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.