Renders the compiled filter AST to a Kysely boolean expression (peer kysely).
Validation-library-free.
Dialect-aware (dialect, default "postgres"): the array ops and ilike are spelled
per dialect: PG native @>/<@/&& + ILIKE, MySQL JSON_CONTAINS/JSON_OVERLAPS +
LIKE, SQLite json_each(…) subqueries + LIKE (see {@link SqlDialect}). On MySQL/SQLite,
like gets an escape clause so the escaped %/_/\ in contains/startsWith/
endsWith match literally. String columns
are passed to sql.ref (server-owned identifiers); computed values use the sql tag.
Render a Sort to Kysely orderBy expressions, allow-listed to columns (public field name → KyselyTarget). Unknown fields are dropped; when nothing is left, defaultSort is used instead. Apply each expression with query.orderBy(expr).
Compile a flat, AND-combined list of column filters into a Kysely boolean expression for .where(where). Only fields in spec whose kind matches the filter’s kind are kept; the rest are silently dropped. where is undefined when nothing survives (skip the .where call then). A date preset filter needs resolveDate (it throws without one). dialect (default "postgres") changes the array ops, ilike and the LIKE escape clause.
Render an already-compiled CompiledWhere AST (from compileFilters / compileFilterNode in @xtandard/lib/filters) to a Kysely boolean expression, looking each field up in columns. Conditions on fields missing from columns are dropped; null (or an AST that drops to nothing) gives undefined. Most code calls buildWhere, which compiles and renders in one step.
Allow-list a public field as an array filter over a column given as a Kysely reference string ("posts.tags") or a raw expression. The SQL depends on dialect: a native array with @>/<@/&& on Postgres, a JSON column with json_contains/json_overlaps on MySQL, and json_each(…) subqueries on SQLite.
Allow-list a public field as a date filter over a timestamp column, given as a Kysely reference string ("posts.created_at") or a raw expression. A date preset needs the resolveDate you pass to buildWhere, and becomes a half-open [start, end) window.
Allow-list a public field as an enum filter (eq/ne/inArray/notInArray/null checks) over a column given as a Kysely reference string ("tasks.status") or a raw expression.
Allow-list a public field as a number filter over a numeric column, given as a Kysely reference string ("orders.total") or a raw expression. between renders as >= from and <= to.
Allow-list a public field as a text filter over a string column, given as a Kysely reference string ("users.name") or a raw expression such as sql`lower(users.name)`. 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).