mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-10-14 09:16:28 +00:00
feat(restheadspec): add x-searchop-notcontain operator
Maps notcontain/notcontains/notlike to a not_ilike filter rendered as (col IS NULL OR CAST(col AS TEXT) NOT ILIKE ?), so NULL rows are kept.
This commit is contained in:
@@ -139,6 +139,10 @@ func BuildJSONFilterCondition(model interface{}, tableAlias, token, operator str
|
||||
return fmt.Sprintf("%s LIKE ?", colExpr), prepend(value), true
|
||||
case "ilike":
|
||||
return fmt.Sprintf("%s ILIKE ?", colExpr), prepend(value), true
|
||||
case "not_ilike":
|
||||
// colExpr appears twice, so its bound args must be repeated too.
|
||||
notArgs := append(append([]interface{}{}, colArgs...), colArgs...)
|
||||
return fmt.Sprintf("(%s IS NULL OR %s NOT ILIKE ?)", colExpr, colExpr), append(notArgs, value), true
|
||||
case "in":
|
||||
inCond, inArgs := BuildInCondition(colExpr, value)
|
||||
if inCond == "" {
|
||||
|
||||
Reference in New Issue
Block a user