Skip to content

booleanField

const booleanField: (input) => KnexFieldSpec;

Defined in: filters/knex.ts:107

Allow-list a public field as a boolean filter (eq/ne/null checks) over a column named by a column string ("done" or "tasks.done").

Parameter Type
input { column: string; }
input.column string

KnexFieldSpec

import { booleanField, buildWhereSql } from "@xtandard/lib/filters/knex";
buildWhereSql({
spec: { done: booleanField({ column: "tasks.done" }) },
filters: [{ field: "done", filter: { kind: "boolean", operator: "eq", value: false } }],
});
// → { sql: '"tasks"."done" = ?', bindings: [false] }