2024-08-08 09:09:17 +00:00
|
|
|
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 {
|
2024-08-08 09:09:17 +00:00
|
|
|
return FromJson[NotLike](data)
|
|
|
|
}
|
|
|
|
|
2024-08-12 18:21:34 +00:00
|
|
|
func (f NotLike) ToSQLPart(ctx Dialect) (string, Values) {
|
2024-08-08 09:09:17 +00:00
|
|
|
if f.NotLike == nil {
|
2024-08-12 18:21:34 +00:00
|
|
|
return "", nil
|
2024-08-08 09:09:17 +00:00
|
|
|
}
|
|
|
|
name := ctx.GetFieldName()
|
|
|
|
value := ctx.NormalizeValue(f.NotLike)
|
2024-08-12 18:21:34 +00:00
|
|
|
return fmt.Sprintf("%s NOT LIKE ? ESCAPE '\\'", name), Values{value}
|
2024-08-08 09:09:17 +00:00
|
|
|
}
|