dal/pkg/filters/NotLike.go

21 lines
424 B
Go
Raw Normal View History

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