Skip to main content

Module row_ref

Module row_ref 

Source
Expand description

Bridge between SqlxRow and prax_query::row::RowRef.

Decodes each column to a string-keyed snapshot so the prax-query FromRow pipeline works uniformly across SQLx’s three backends (Postgres, MySQL, SQLite). Strings are materialized eagerly so get_str can hand back a borrowed slice.

§Type-dispatched decoding

Cells are decoded by dispatching on the column’s reported type (Column::type_info()) rather than trial-decoding a fixed list of Rust types. SQLx’s Decode<String> only accepts TEXT-family wire types (and the numeric decoders only accept their exact Postgres OIDs), so the old probe chain silently collapsed TIMESTAMP, UUID, JSON, NUMERIC, DATE, and TIME cells into [Value::Null] — a non-null DateTime read into Option<DateTime> came back None. With type-dispatch, every recognised type lands in its proper [Value] variant, and cells we genuinely cannot decode surface RowError::TypeConversion instead of a fabricated NULL.

The chrono/uuid/json/rust_decimal decoders below rely on the matching sqlx features, which prax-sqlx’s Cargo.toml enables unconditionally.

Structs§

SqlxRowRef
A driver-agnostic decoded row produced by the sqlx engine. Holds owned values keyed by column name so callers can access them after the row itself has been dropped.