toDrizzleRqbWhere
function toDrizzleRqbWhere(input): | DrizzleRqbWhere | undefined;Defined in: filters/drizzle-rqb.ts:200
Render an already-compiled CompiledWhere AST (from compileFilters /
compileFilterNode in @xtandard/lib/filters) to an RQB v2 where object, mapping each
field to a schema property key through columns. Conditions on fields missing from
columns are dropped; null (or an AST that drops to nothing) gives undefined. Most code
calls buildWhere, which compiles and renders in one step.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ columns: Record<string, string>; where: | CompiledWhere | null; } |
input.columns |
Record<string, string> |
input.where |
| CompiledWhere | null |
Returns
Section titled “Returns”| DrizzleRqbWhere
| undefined
Example
Section titled “Example”import { toDrizzleRqbWhere } from "@xtandard/lib/filters/drizzle-rqb";
toDrizzleRqbWhere({ where: { type: "and", nodes: [ { type: "cond", cond: { field: "amount", op: "gt", value: 5 } }, { type: "cond", cond: { field: "name", op: "isNotNull" } }, ] }, columns: { amount: "amount", name: "name" },});// → { AND: [{ amount: { gt: 5 } }, { name: { isNotNull: true } }] }