dal/pkg/filters/Glob.go

21 lines
386 B
Go
Raw Normal View History

package filters
import "fmt"
type Glob struct {
Glob interface{} `json:"$glob"`
}
2024-08-08 17:26:29 +00:00
func (f Glob) FromJSON(data interface{}) IFilter {
return FromJson[Glob](data)
}
func (f Glob) ToSQLPart(ctx Dialect) (string, Values) {
if f.Glob == nil {
return "", nil
}
name := ctx.GetFieldName()
value := ctx.NormalizeValue(f.Glob)
return fmt.Sprintf("%s GLOB ?", name), Values{value}
}