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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
op |
"endsWith" | "startsWith" | "contains" | "like" | "ilike" | "notIlike" |
value |
string |
Returns
Section titled “Returns”object
| Name | Type | Defined in |
|---|---|---|
op |
"like" | "ilike" | "notIlike" |
filters/compile.ts:95 |
pattern |
string |
filters/compile.ts:95 |
Example
Section titled “Example”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)