Expand description
Core SQL builder for constructing parameterized queries.
Sits at the foundation of the query module. Every other module in query/
uses SqlBuilder to accumulate SQL text and bind parameters.
§Design
SqlBuilder wraps a String buffer and a Vec<SqlParam>. As SQL fragments
are appended, user-supplied values are stored in the param list while the
buffer receives $1, $2, … placeholders. The final build() call returns
the completed SQL string paired with the ordered parameter vector, ready for
sqlx::query_with.
§SQL Example
-- After pushing: push("SELECT "), push_ident("name"), push(" FROM "),
-- push_qi(qi), push(" WHERE "), push_ident("age"), push(" >= "),
-- push_param(Text("18"))
SELECT "name" FROM "public"."users" WHERE "age" >= $1Structs§
- SqlBuilder
- Accumulates SQL text and bind parameters into a parameterized query.
Enums§
- SqlParam
- A bind parameter for a parameterized SQL query.
Functions§
- escape_
ident - Escape a SQL identifier by doubling internal double-quotes.
- escape_
literal - Escape a SQL literal by doubling single-quotes.
- quote_
ident - Double-quote a SQL identifier.
- quote_
literal - Single-quote a SQL literal (with E-string for backslashes).