feat(restheadspec): match NULL when x-fieldfilter compares a numeric column to 0

Adds a SetNullAsZero handler option: on by default in restheadspec (for
x-fieldfilter only), off by default in resolvespec. When enabled, an eq
filter of 0 on a numeric column renders (col = 0 OR col IS NULL).
This commit is contained in:
Hein
2026-10-12 15:49:57 +02:00
parent fbfc1aadb5
commit d3252f3d02
7 changed files with 239 additions and 2 deletions
+4
View File
@@ -87,6 +87,10 @@ type FilterOption struct {
Operator string `json:"operator"`
Value interface{} `json:"value"`
LogicOperator string `json:"logic_operator"` // "AND" or "OR" - how this filter combines with previous filters
// NullAsZero makes an "eq" filter on a numeric column with a zero value also
// match NULLs (COALESCE(col, 0) = 0). Set for x-fieldfilter headers only.
NullAsZero bool `json:"-"`
}
type SortOption struct {