mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-14 11:17:19 +03:00
Remove Alpha from QueryOptions. Also add Filter, not implemented yet
This commit is contained in:
parent
0a56fd8752
commit
ca04a919ad
@ -41,12 +41,12 @@ func (g *listGenerator) query(qo model.QueryOptions, offset int, size int) (Entr
|
||||
}
|
||||
|
||||
func (g *listGenerator) GetNewest(offset int, size int) (Entries, error) {
|
||||
qo := model.QueryOptions{SortBy: "CreatedAt", Desc: true, Alpha: true}
|
||||
qo := model.QueryOptions{SortBy: "CreatedAt", Desc: true}
|
||||
return g.query(qo, offset, size)
|
||||
}
|
||||
|
||||
func (g *listGenerator) GetRecent(offset int, size int) (Entries, error) {
|
||||
qo := model.QueryOptions{SortBy: "PlayDate", Desc: true, Alpha: true}
|
||||
qo := model.QueryOptions{SortBy: "PlayDate", Desc: true}
|
||||
return g.query(qo, offset, size)
|
||||
}
|
||||
|
||||
@ -61,12 +61,12 @@ func (g *listGenerator) GetHighest(offset int, size int) (Entries, error) {
|
||||
}
|
||||
|
||||
func (g *listGenerator) GetByName(offset int, size int) (Entries, error) {
|
||||
qo := model.QueryOptions{SortBy: "Name", Alpha: true}
|
||||
qo := model.QueryOptions{SortBy: "Name"}
|
||||
return g.query(qo, offset, size)
|
||||
}
|
||||
|
||||
func (g *listGenerator) GetByArtist(offset int, size int) (Entries, error) {
|
||||
qo := model.QueryOptions{SortBy: "Artist", Alpha: true}
|
||||
qo := model.QueryOptions{SortBy: "Artist"}
|
||||
return g.query(qo, offset, size)
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,16 @@ var (
|
||||
ErrNotFound = errors.New("data not found")
|
||||
)
|
||||
|
||||
// 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
|
||||
type Filters map[string]interface{}
|
||||
|
||||
type QueryOptions struct {
|
||||
SortBy string
|
||||
Alpha bool
|
||||
Desc bool
|
||||
Offset int
|
||||
Size int
|
||||
SortBy string
|
||||
Desc bool
|
||||
Offset int
|
||||
Size int
|
||||
Filters Filters
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user