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