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:
Hein
2026-10-12 15:56:42 +02:00
parent d3252f3d02
commit 5dbe187915
6 changed files with 55 additions and 2 deletions
+4
View File
@@ -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 == "" {