textField
const textField: (input) => PostgrestFieldSpec;Defined in: filters/postgrest.ts:68
Allow-list a public field as a text filter over a PostgREST column. contains/
startsWith/endsWith become ilike with * wildcards (the user’s %, _ and \ are
escaped); like/ilike patterns are passed through with % spelled *. A literal *
can’t be written in a PostgREST LIKE pattern, so those fall back to match/imatch
(POSIX regex).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ column: string; } |
input.column |
string |
Returns
Section titled “Returns”Example
Section titled “Example”import { buildParams, textField } from "@xtandard/lib/filters/postgrest";
const spec = { name: textField({ column: "name" }) };buildParams({ spec, filters: [{ field: "name", filter: { kind: "text", operator: "contains", value: "50%" } }] }).params;// → [["name", "ilike.*50\\%*"]] (prints as ilike.*50\%*)buildParams({ spec, filters: [{ field: "name", filter: { kind: "text", operator: "startsWith", value: "a*b" } }] }).params;// → [["name", "imatch.^a\\*b"]] (prints as imatch.^a\*b)