navidrome/model/datastore.go

39 lines
918 B
Go
Raw Normal View History

2020-01-15 04:22:34 +01:00
package model
import (
2020-01-20 02:40:18 +01:00
"github.com/deluan/rest"
)
// Filters use the same operators as Beego ORM: See https://beego.me/docs/mvc/model/query.md#operators
// Ex: var q = QueryOptions{Filters: Filters{"name__istartswith": "Deluan","age__gt": 25}}
// All conditions will be ANDed together
// TODO Implement filter in repositories' methods
2016-03-04 04:44:28 +01:00
type QueryOptions struct {
Sort string
Order string
Max int
Offset int
Filters map[string]interface{}
2016-03-04 04:44:28 +01:00
}
2020-01-20 02:40:18 +01:00
type ResourceRepository interface {
rest.Repository
rest.Persistable
}
type DataStore interface {
Album() AlbumRepository
Artist() ArtistRepository
MediaFile() MediaFileRepository
MediaFolder() MediaFolderRepository
Genre() GenreRepository
Playlist() PlaylistRepository
Property() PropertyRepository
User() UserRepository
2020-01-22 05:01:43 +01:00
Annotation() AnnotationRepository
2020-01-20 02:40:18 +01:00
Resource(model interface{}) ResourceRepository
WithTx(func(tx DataStore) error) error
}