dal/pkg/filters/registry.go
Anton Nesterov d28d976b8e
[wip] dal golang
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-07 21:16:40 +02:00

25 lines
484 B
Go

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