dal/pkg/filters/registry.go
Anton Nesterov 8e45c45624
[wip] add missing filters
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-08 11:09:17 +02:00

30 lines
605 B
Go

package filters
var FilterRegistry = map[string]Filter{
"And": &And{},
"Or": &Or{},
"Eq": &Eq{},
"Ne": &Ne{},
"Gt": &Gt{},
"Gte": &Gte{},
"Lt": &Lt{},
"Lte": &Lte{},
"In": &In{},
"Nin": &NotIn{},
"Between": &Between{},
"NotBetween": &NotBetween{},
"Glob": &Glob{},
"Like": &Like{},
"NotLike": &NotLike{},
}
func Convert(ctx Context, json interface{}) string {
for _, t := range FilterRegistry {
value := t.FromJSON(json).ToSQLPart(ctx)
if value != "" {
return value
}
}
return ""
}