pub struct PgRow<'a>(_, _);
Implementations
sourceimpl<'a> PgRow<'a>
impl<'a> PgRow<'a>
sourcepub fn is_null(&self, column: u32) -> bool
pub fn is_null(&self, column: u32) -> bool
True if the value is NULL.
column
- The number of the column which value is to be tested withPQgetisnull
. 0-based.
sourcepub fn ftype(&self, column: u32) -> Oid
pub fn ftype(&self, column: u32) -> Oid
PostgreSQL internal OID number of the column type.
column
- The number of the column which type is to be retrieved withPQftype
. 0-based.
sourcepub fn fname(&'a self, column: u32) -> Result<&'a str, Utf8Error>
pub fn fname(&'a self, column: u32) -> Result<&'a str, Utf8Error>
Returns the column name associated with the given column number. Column numbers start at 0.
column
- The number of the column. 0-based.
sourcepub fn col(&self, column: u32) -> &'a [u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn col(&self, column: u32) -> &'a [u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Get the byte slice of a value in the given column.
Returns an empty array if the value is NULL.
column
- The column number. 0-based.
sourcepub fn col_str(&self, column: u32) -> Result<&'a str, Utf8Error>
pub fn col_str(&self, column: u32) -> Result<&'a str, Utf8Error>
Tries to get an UTF-8 slice of a value in the given column.
Returns an empty string if the value is NULL.
column
- The column number. 0-based.
sourcepub fn bytea(&self, column: u32) -> Vec<u8>
pub fn bytea(&self, column: u32) -> Vec<u8>
Binary data unescaped from a bytea column.
column
- The column number. 0-based.
sourcepub fn col_json(&self, column: u32, name: &str) -> Result<Json, PgFutureErr>
pub fn col_json(&self, column: u32, name: &str) -> Result<Json, PgFutureErr>
Converts the column into JSON.
column
- The number of the column which value is to be converted to JSON. 0-based.name
- The name of the column. To make the errors more verbose if they’d happen.
sourcepub fn col_deserialize<T: DeserializeOwned>(
&self,
column: u32,
name: &str
) -> Result<T, PgFutureErr>
pub fn col_deserialize<T: DeserializeOwned>(
&self,
column: u32,
name: &str
) -> Result<T, PgFutureErr>
Auto-unpack the column value.
sourcepub fn to_json(&self) -> Result<Json, PgFutureErr>
pub fn to_json(&self) -> Result<Json, PgFutureErr>
Converts the row into JSON, {$name: $value, …}.
Auto Trait Implementations
impl<'a> RefUnwindSafe for PgRow<'a>
impl<'a> Send for PgRow<'a>
impl<'a> Sync for PgRow<'a>
impl<'a> Unpin for PgRow<'a>
impl<'a> UnwindSafe for PgRow<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more