mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Fix Player filter
This commit is contained in:
parent
290333ec59
commit
eaa7f7c7e9
4 changed files with 7 additions and 5 deletions
|
@ -23,7 +23,7 @@ func NewGenreRepository(ctx context.Context, db dbx.Builder) model.GenreReposito
|
|||
r.db = db
|
||||
r.tableName = "genre"
|
||||
r.filterMappings = map[string]filterFunc{
|
||||
"name": containsFilter,
|
||||
"name": containsFilter("name"),
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ func NewPlayerRepository(ctx context.Context, db dbx.Builder) model.PlayerReposi
|
|||
r.db = db
|
||||
r.tableName = "player"
|
||||
r.filterMappings = map[string]filterFunc{
|
||||
"name": containsFilter,
|
||||
"name": containsFilter("player.name"),
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func NewRadioRepository(ctx context.Context, db dbx.Builder) model.RadioReposito
|
|||
r.db = db
|
||||
r.tableName = "radio"
|
||||
r.filterMappings = map[string]filterFunc{
|
||||
"name": containsFilter,
|
||||
"name": containsFilter("name"),
|
||||
}
|
||||
r.sortMappings = map[string]string{
|
||||
"name": "(name collate nocase), name",
|
||||
|
|
|
@ -59,8 +59,10 @@ func startsWithFilter(field string, value interface{}) Sqlizer {
|
|||
return Like{field: fmt.Sprintf("%s%%", value)}
|
||||
}
|
||||
|
||||
func containsFilter(field string, value interface{}) Sqlizer {
|
||||
return Like{field: fmt.Sprintf("%%%s%%", value)}
|
||||
func containsFilter(field string) func(string, any) Sqlizer {
|
||||
return func(_ string, value any) Sqlizer {
|
||||
return Like{field: fmt.Sprintf("%%%s%%", value)}
|
||||
}
|
||||
}
|
||||
|
||||
func booleanFilter(field string, value interface{}) Sqlizer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue