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