dal/pkg/filters/NotLike.go
Anton Nesterov 43dd4e9234
[ref] name things what they are
Signed-off-by: Anton Nesterov <anton@demiurg.io>
2024-08-11 21:49:49 +02:00

21 lines
402 B
Go

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