Skip to content

textField

const textField: (input) => DrizzleRqbFieldSpec;

Defined in: filters/drizzle-rqb.ts:71

Allow-list a public field as a text filter over a string column, named by its Drizzle schema property key ("name"). contains/startsWith/endsWith become ilike with the input’s %/_/\ escaped. That is Postgres-only in the RQB v2 object (no ESCAPE, and SQLite/MySQL have no ilike); the v1 callback renders like … escape on those columns.

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

DrizzleRqbFieldSpec

import { buildWhere, textField } from "@xtandard/lib/filters/drizzle-rqb";
const { where } = buildWhere({
spec: { name: textField({ column: "name" }) },
filters: [{ field: "name", filter: { kind: "text", operator: "contains", value: "ann" } }],
});
// where → { name: { ilike: "%ann%" } }