Expand description
Execution integration between qbrs’s query builder and a real Postgres
via sqlx. This crate owns only the value-binding and row-decoding glue;
query building, SQL rendering, and every compile-time guarantee live in
qbrs-core, which stays independent of any async runtime or driver.
Modules§
- prelude
- Every extension trait that puts a terminal method on a builder, plus the
error type a caller’s own signatures have to name and the
DecodeRowbound a generic helper overRowQueryhas to spell.Resultis deliberately absent: a glob-imported alias of that name shadowsstd::result::Resultin every module that follows, and a service layer has its own error type in most of them — writeqbrs_sqlx::Result<T>where the alias is wanted. Which trait applies depends on the builder, so importing them one at a time is bookkeeping with no decision in it — andcountin particular resolves againstIterator::countwith a confusing message untilCountExtis in scope.
Enums§
- Error
- Errors from executing a qbrs query against Postgres via
sqlx. An enum rather than a baresqlx::Errorso a qbrs-level misuse is distinguishable from a driver/database error without string-matching a message.
Traits§
- Count
Ext - The bound is on the method, and the impls are per-builder, for the two
reasons
LoadExtexplains. - Count
Query SELECT count(*)over a query’sFROM/JOIN/WHERE/GROUP BY, with itsORDER BY/LIMIT/OFFSETdropped — a total counts the rows that match, not the page being shown. Returns a number rather than anOption, since a count query always produces exactly one row.- Decode
Row - Decodes a query’s
Outputpositionally out of aPgRow. Keyed on the plain-Rust type a selection produces rather than on the selection itself: erasure leaves onlyOutput, with noSelectionimpl left to hang decoding off, so this is implemented directly against the closed set of native types. - Execute
Ext - The bound is on the method, and the impls are per-builder, for the two
reasons
LoadExtexplains. - LoadExt
loadfor the rows,load_onefor the first of them, andExecuteExt::executewhere there are none to decode. One trait for every row-producing builder keeps the terminal vocabulary tied to what a statement yields rather than to which builder happens to be in hand.- Prepared
Count Ext - The bound is on the method, and the impls are per-builder, for the two
reasons
LoadExtexplains. - Prepared
Ext - The bound is on the method, and the impls are per-builder, for the two
reasons
LoadExtexplains. - Prepared
Query - Runs a
prepare!{}-built query, resolving its named placeholders fromparamsfirst. Separate fromLoadExtonly because the values arrive at the call rather than being baked into the query: onePreparedis meant to serve many calls, and.resolve()clones the template rather than re-rendering it. - Prepared
Total - A prepared total. Separate from
PreparedExtfor the reasonCountExtis separate fromLoadExt: a count produces a number, not rows. - RowQuery
- What a row-producing query renders to, and what its rows decode to: a
SELECT, aRETURNINGclause, an erasedDynSelect, aUNIONchain.LoadExtis the pair of methods over it, and the split is load-bearing — with the validity bound on the impl instead, an invalid selection makes.load(..)not exist, and the scope error the builder wanted to report is replaced by a method-resolution failure that never mentions the table. - Write
Statement - Every writing statement, rendered: what
executereturns is rows affected, whichever of the three it was.
Type Aliases§
- Result
- This crate’s
Result: the same shape assqlx::Result, withqbrs_sqlx::Erroras the fixed error type.