2020-01-14 18:22:34 -09:00
|
|
|
package model
|
2016-03-02 05:33:49 -09:00
|
|
|
|
2020-01-19 11:37:41 -09:00
|
|
|
import (
|
2020-01-19 16:40:18 -09:00
|
|
|
"github.com/deluan/rest"
|
2020-01-19 11:37:41 -09:00
|
|
|
)
|
2016-03-18 07:33:50 -08:00
|
|
|
|
2020-01-15 19:49:20 -09:00
|
|
|
// 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 {
|
2020-01-19 18:36:15 -09:00
|
|
|
Sort string
|
|
|
|
|
Order string
|
|
|
|
|
Max int
|
2020-01-15 19:49:20 -09:00
|
|
|
Offset int
|
2020-01-19 18:36:15 -09:00
|
|
|
Filters map[string]interface{}
|
2016-03-03 18:44:28 -09:00
|
|
|
}
|
2020-01-19 11:37:41 -09:00
|
|
|
|
2020-01-19 16:40:18 -09:00
|
|
|
type ResourceRepository interface {
|
|
|
|
|
rest.Repository
|
|
|
|
|
rest.Persistable
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-19 11:37:41 -09:00
|
|
|
type DataStore interface {
|
|
|
|
|
Album() AlbumRepository
|
|
|
|
|
Artist() ArtistRepository
|
|
|
|
|
MediaFile() MediaFileRepository
|
|
|
|
|
MediaFolder() MediaFolderRepository
|
|
|
|
|
Genre() GenreRepository
|
|
|
|
|
Playlist() PlaylistRepository
|
|
|
|
|
Property() PropertyRepository
|
2020-01-19 18:36:15 -09:00
|
|
|
User() UserRepository
|
2020-01-21 19:01:43 -09:00
|
|
|
Annotation() AnnotationRepository
|
2020-01-19 11:37:41 -09:00
|
|
|
|
2020-01-19 16:40:18 -09:00
|
|
|
Resource(model interface{}) ResourceRepository
|
|
|
|
|
|
2020-01-19 11:37:41 -09:00
|
|
|
WithTx(func(tx DataStore) error) error
|
|
|
|
|
}
|