Expand description
Bridge between tokio_postgres::Row and prax_query::row::RowRef.
RowRef is defined in prax-query and Row is defined in tokio-postgres;
both are foreign to this crate, so Rust’s orphan rules forbid a direct
impl RowRef for Row. We wrap the row in a #[repr(transparent)] newtype
(PgRow) and implement the trait on the wrapper.
§Dual API surface
PgRow derefs to the wrapped Row, so callers can use either API:
- The generic
RowRefinterface (pg_row.get_i32("id")) — portable across drivers and what generatedFromRowimpls use. - The native
tokio_postgres::Rowinterface (pg_row.try_get::<_, i32>("id")) — full access to the driver’s type system for columnsRowRefdoes not model (arrays, range types, etc.).
§rust_decimal support
tokio-postgres 0.7 ships no with-rust_decimal-* feature gate of its
own; instead the rust_decimal crate’s db-tokio-postgres feature
(enabled in this crate’s Cargo.toml) provides the FromSql/ToSql
impls bridging NUMERIC and rust_decimal::Decimal. PgRow::get_decimal
and PgRow::get_decimal_opt therefore decode NUMERIC columns directly
through the driver, the same way decode_aggregate_cell reads AVG()
results.
Structs§
- PgRow
- Newtype wrapper around
tokio_postgres::Rowthat implementsprax_query::row::RowRef.