textField
const textField: (input) => KnexFieldSpec;Defined in: filters/knex.ts:59
Allow-list a public field as a text filter over a string column, named by a column string
("name" or "users.name", quoted per part; anything else throws). contains/startsWith/
endsWith render as ILIKE on Postgres and LIKE on MySQL/SQLite, with the input’s
%/_/\ escaped (plus an ESCAPE clause on MySQL/SQLite, so they match literally).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ column: string; } |
input.column |
string |
Returns
Section titled “Returns”Example
Section titled “Example”import { buildWhereSql, textField } from "@xtandard/lib/filters/knex";
buildWhereSql({ spec: { name: textField({ column: "users.name" }) }, filters: [{ field: "name", filter: { kind: "text", operator: "contains", value: "ann" } }],});// → { sql: '"users"."name" ILIKE ?', bindings: ["%ann%"] }