pub struct PgRow(/* private fields */);Expand description
Newtype wrapper around tokio_postgres::Row that implements
prax_query::row::RowRef.
The inner row is private; use PgRow::into_inner when ownership is
needed (e.g., forwarding to a tokio-postgres API that consumes Row).
For read-only access, the Deref<Target = Row> impl lets you call
any Row method directly.
Implementations§
Methods from Deref<Target = Row>§
Sourcepub fn get<'a, I, T>(&'a self, idx: I) -> T
pub fn get<'a, I, T>(&'a self, idx: I) -> T
Deserializes a value from the row.
The value can be specified either by its numeric index in the row, or by its column name.
§Panics
Panics if the index is out of bounds or if the value cannot be converted to the specified type.
Sourcepub fn try_get<'a, I, T>(&'a self, idx: I) -> Result<T, Error>
pub fn try_get<'a, I, T>(&'a self, idx: I) -> Result<T, Error>
Like Row::get, but returns a Result rather than panicking.
Sourcepub fn raw_size_bytes(&self) -> usize
pub fn raw_size_bytes(&self) -> usize
Returns the raw size of the row in bytes.
Trait Implementations§
Source§impl RowRef for PgRow
impl RowRef for PgRow
Source§fn get_i32_opt(&self, c: &str) -> Result<Option<i32>, RowError>
fn get_i32_opt(&self, c: &str) -> Result<Option<i32>, RowError>
Get an optional integer column value.
Source§fn get_i64_opt(&self, c: &str) -> Result<Option<i64>, RowError>
fn get_i64_opt(&self, c: &str) -> Result<Option<i64>, RowError>
Get an optional 64-bit integer column value.
Source§fn get_f64_opt(&self, c: &str) -> Result<Option<f64>, RowError>
fn get_f64_opt(&self, c: &str) -> Result<Option<f64>, RowError>
Get an optional float column value.
Source§fn get_bool_opt(&self, c: &str) -> Result<Option<bool>, RowError>
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>
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>
fn get_str_opt(&self, c: &str) -> Result<Option<&str>, RowError>
Get an optional string column value as a borrowed reference.
Source§fn get_bytes(&self, c: &str) -> Result<&[u8], RowError>
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>
fn get_bytes_opt(&self, c: &str) -> Result<Option<&[u8]>, RowError>
Get optional bytes as borrowed reference.
fn get_datetime_utc(&self, c: &str) -> Result<DateTime<Utc>, RowError>
fn get_datetime_utc_opt( &self, c: &str, ) -> Result<Option<DateTime<Utc>>, RowError>
fn get_naive_datetime(&self, c: &str) -> Result<NaiveDateTime, RowError>
fn get_naive_datetime_opt( &self, c: &str, ) -> Result<Option<NaiveDateTime>, RowError>
fn get_naive_date(&self, c: &str) -> Result<NaiveDate, RowError>
fn get_naive_date_opt(&self, c: &str) -> Result<Option<NaiveDate>, RowError>
fn get_naive_time(&self, c: &str) -> Result<NaiveTime, RowError>
fn get_naive_time_opt(&self, c: &str) -> Result<Option<NaiveTime>, RowError>
fn get_uuid(&self, c: &str) -> Result<Uuid, RowError>
fn get_uuid_opt(&self, c: &str) -> Result<Option<Uuid>, RowError>
fn get_json(&self, c: &str) -> Result<Value, RowError>
fn get_json_opt(&self, c: &str) -> Result<Option<Value>, RowError>
fn get_decimal(&self, c: &str) -> Result<Decimal, RowError>
fn get_decimal_opt(&self, c: &str) -> Result<Option<Decimal>, RowError>
Source§fn get_string(&self, column: &str) -> Result<String, RowError>
fn get_string(&self, column: &str) -> Result<String, RowError>
Get a string column value as owned (for cases where ownership is needed).
Auto Trait Implementations§
impl !Freeze for PgRow
impl !RefUnwindSafe for PgRow
impl Send for PgRow
impl Sync for PgRow
impl Unpin for PgRow
impl UnsafeUnpin for PgRow
impl !UnwindSafe for PgRow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more