This document is the English counterpart of xb/doc/ALL_FILTERING_MECHANISMS.md. It explains how xb automatically skips empty inputs, how InRequired protects destructive operations, and how higher level blocks behave when their internal conditions collapse.
Eq, Ne, Gt, Gte, Lt, Lte, Like, LikeLeftfalse booleans, and nil pointers are ignored.time.Time values are always serialized (converted to YYYY-MM-DD HH:MM:SS).xb.Of("t_user").
Eq("status", 0). // skipped
Eq("status", 1). // included
Like("name", ""). // skipped
Like("name", "ai"). // included
Build()
IN / NOT INnil.InRequired panics when the remaining list is empty, which is perfect for admin bulk actions.xb.Of("orders").
In("id", 0, nil, 9, 10). // renders IN (9,10)
xb.Of("orders").
InRequired("id", ids...). // panic if ids collapses to empty
Or(func(*CondBuilder)), And(func(*CondBuilder)), Cond(func(*CondBuilder))WHERE ().Like, NotLike, LikeLeft all skip empty strings.doLike injects the proper wildcard placement (%foo%, foo%).| Symptom | Explanation |
|---|---|
| Condition missing | Value was auto-filtered; inspect built.Conds |
| IN disappeared | Input collapsed to zero elements |
| OR block missing | Every nested condition skipped |
| Need strict enforcement | Swap to InRequired or add X() raw expressions |
Use fmt.Printf("%#v\n", built.Conds) in tests to inspect the final AST.
doc/en/FILTERING.md – condensed overviewxb/doc/EMPTY_OR_AND_FILTERING.md – legacy Chinese referencedoc/en/TESTING_STRATEGY.md – ideas for asserting automatic filtering in tests