quintodrome/model/datastore.go

39 lines
918 B
Go
Raw Normal View History

2020-01-14 18:22:34 -09:00
package model
import (
2020-01-19 16:40:18 -09: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-03 18:44:28 -09:00
type QueryOptions struct {
Sort string
Order string
Max int
Offset int
Filters map[string]interface{}
2016-03-03 18:44:28 -09:00
}
2020-01-19 16:40:18 -09: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-21 19:01:43 -09:00
Annotation() AnnotationRepository
2020-01-19 16:40:18 -09:00
Resource(model interface{}) ResourceRepository
WithTx(func(tx DataStore) error) error
}