d28d976b8e
Signed-off-by: Anton Nesterov <anton@demiurg.io>
21 lines
363 B
Go
21 lines
363 B
Go
package filters
|
|
|
|
import "fmt"
|
|
|
|
type Glob struct {
|
|
Glob interface{} `json:"$glob"`
|
|
}
|
|
|
|
func (f Glob) FromJSON(data interface{}) Filter {
|
|
return FromJson[Glob](data)
|
|
}
|
|
|
|
func (f Glob) ToSQLPart(ctx Context) string {
|
|
if f.Glob == nil {
|
|
return ""
|
|
}
|
|
name := ctx.GetFieldName()
|
|
value := ctx.NormalizeValue(f.Glob)
|
|
return fmt.Sprintf("%s GLOB %v", name, value)
|
|
}
|