Skip to content

sqlTextOp

function sqlTextOp(op, value): object;

Defined in: filters/compile.ts:92

Lower a semantic text-match op to a SQL LIKE/ILIKE (op, pattern) — shared by the SQL adapters (drizzle/kysely/knex). contains/startsWith/ endsWith become ilike with an escaped % pattern; like/ilike/ notIlike pass the pattern through verbatim.

Parameter Type
op "endsWith" | "startsWith" | "contains" | "like" | "ilike" | "notIlike"
value string

object

Name Type Defined in
op "like" | "ilike" | "notIlike" filters/compile.ts:95
pattern string filters/compile.ts:95
import { sqlTextOp } from "@xtandard/lib/filters";
sqlTextOp("startsWith", "ada"); // → { op: "ilike", pattern: "ada%" }
sqlTextOp("contains", "50%"); // → { op: "ilike", pattern: "%50\\%%" } (escaped)
sqlTextOp("like", "A_%"); // → { op: "like", pattern: "A_%" } (verbatim)