Skip to main content

Module expr

Module expr 

Source
Expand description

SQL expression helpers for dynamic queries. Helpers for building safe SQL expressions for use with Values.

Expressions are SQL fragments that can be embedded into {set:...}, {insert:...}, and {where:...} placeholders. Unlike regular bound values, expressions may expand to arbitrary SQL (optionally containing their own bind parameters).

Expression fragments support anonymous ? and named bind parameters. Numeric positional placeholders such as ?1 and numeric $1 are rejected when an expression is embedded because their absolute SQLite indices cannot be safely rebased inside a larger statement.

Use curated helpers (like crate::expr::now_rfc3339_utc) whenever possible. If you must embed ad-hoc SQL, use crate::expr::raw, which will taint the resulting query.

Structs§

Expr
A SQL expression fragment with optional bound parameters.

Functions§

jsonb
Wrap a JSON text value with SQLite’s jsonb(...) function.
jsonb_serde
Serialize a value to JSON and wrap it with SQLite’s jsonb(...) function.
jsonb_text
Wrap a JSON text value with SQLite’s jsonb(...) function.
now_rfc3339_utc
SQLite expression for the current UTC time, formatted as RFC3339.
raw
Embed raw SQL as an expression and taint the resulting query.