Skip to main content

SqlxRowRef

Struct SqlxRowRef 

Source
pub struct SqlxRowRef { /* private fields */ }
Expand description

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.

Implementations§

Source§

impl SqlxRowRef

Source

pub fn from_sqlx(row: &SqlxRow) -> Result<Self, RowError>

Decode a raw sqlx row into a driver-agnostic SqlxRowRef.

Returns RowError::TypeConversion if any column’s wire type cannot be decoded into a [Value] — a column is never silently recorded as NULL unless it actually is NULL.

Trait Implementations§

Source§

impl RowRef for SqlxRowRef

Source§

fn get_string(&self, c: &str) -> Result<String, RowError>

Override the trait default (get_str + to_string) so String-typed model fields can read columns decoded into a non-text variant — most importantly String @db.Uuid schema fields over native UUID columns, mirroring PgRow::get_string in prax-postgres. Datetimes stringify as RFC 3339; decimals and JSON use their canonical text forms.

Source§

fn is_null(&self, c: &str) -> Result<bool, RowError>

Override the trait default (which delegates to get_str_opt and therefore errors on any non-text, non-null cell — I64, F64, Bool, Bytes, …) with a direct snapshot probe. This is what the blanket impl<T: FromColumn> FromColumn for Option<T> calls to short-circuit nullable columns, so Option<i32> = Some(5) must get Ok(false) here rather than a “not text” failure. Mirrors the NullProbe override on PgRow in prax-postgres.

Source§

fn get_i32(&self, c: &str) -> Result<i32, RowError>

Get an integer column value.
Source§

fn get_i32_opt(&self, c: &str) -> Result<Option<i32>, RowError>

Get an optional integer column value.
Source§

fn get_i64(&self, c: &str) -> Result<i64, RowError>

Get a 64-bit integer column value.
Source§

fn get_i64_opt(&self, c: &str) -> Result<Option<i64>, RowError>

Get an optional 64-bit integer column value.
Source§

fn get_f64(&self, c: &str) -> Result<f64, RowError>

Get a float column value.
Source§

fn get_f64_opt(&self, c: &str) -> Result<Option<f64>, RowError>

Get an optional float column value.
Source§

fn get_bool(&self, c: &str) -> Result<bool, RowError>

Get a boolean column value.
Source§

fn get_bool_opt(&self, c: &str) -> Result<Option<bool>, RowError>

Get an optional boolean column value.
Source§

fn get_str(&self, c: &str) -> Result<&str, RowError>

Get a string column value as a borrowed reference (zero-copy). Read more
Source§

fn get_str_opt(&self, c: &str) -> Result<Option<&str>, RowError>

Get an optional string column value as a borrowed reference.
Source§

fn get_string_opt(&self, c: &str) -> Result<Option<String>, RowError>

Get an optional string as owned.
Source§

fn get_bytes(&self, c: &str) -> Result<&[u8], RowError>

Get a bytes column value as a borrowed reference (zero-copy).
Source§

fn get_bytes_opt(&self, c: &str) -> Result<Option<&[u8]>, RowError>

Get optional bytes as borrowed reference.
Source§

fn get_datetime_utc(&self, c: &str) -> Result<DateTime<Utc>, RowError>

Source§

fn get_datetime_utc_opt( &self, c: &str, ) -> Result<Option<DateTime<Utc>>, RowError>

Source§

fn get_naive_datetime(&self, c: &str) -> Result<NaiveDateTime, RowError>

Source§

fn get_naive_datetime_opt( &self, c: &str, ) -> Result<Option<NaiveDateTime>, RowError>

Source§

fn get_naive_date(&self, c: &str) -> Result<NaiveDate, RowError>

Source§

fn get_naive_date_opt(&self, c: &str) -> Result<Option<NaiveDate>, RowError>

Source§

fn get_naive_time(&self, c: &str) -> Result<NaiveTime, RowError>

Source§

fn get_naive_time_opt(&self, c: &str) -> Result<Option<NaiveTime>, RowError>

Source§

fn get_uuid(&self, c: &str) -> Result<Uuid, RowError>

Source§

fn get_uuid_opt(&self, c: &str) -> Result<Option<Uuid>, RowError>

Source§

fn get_json(&self, c: &str) -> Result<Value, RowError>

Source§

fn get_json_opt(&self, c: &str) -> Result<Option<Value>, RowError>

Source§

fn get_decimal(&self, c: &str) -> Result<Decimal, RowError>

Source§

fn get_decimal_opt(&self, c: &str) -> Result<Option<Decimal>, RowError>

Source§

fn get_cow_str(&self, column: &str) -> Result<Cow<'_, str>, RowError>

Get column value as a Cow, borrowing when possible.
Source§

fn get_vector(&self, column: &str) -> Result<Vec<f32>, RowError>

Get a pgvector column as a dense Vec<f32>. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more