Struct PgRow

Source
pub struct PgRow<'a>(/* private fields */);

Implementations§

Source§

impl<'a> PgRow<'a>

Source

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 with PQgetisnull. 0-based.
Source

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 with PQftype. 0-based.
Source

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.
Source

pub fn num(&self) -> u32

Return this row’s number withing the result.

Source

pub fn len(&self) -> u32

Returns the number of columns in the row. Row numbers start at 0.

Source

pub fn col(&self, column: u32) -> &'a [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.
Source

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.
Source

pub fn bytea(&self, column: u32) -> Vec<u8>

Binary data unescaped from a bytea column.

  • column - The column number. 0-based.
Source

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.
Source

pub fn col_deserialize<T: DeserializeOwned>( &self, column: u32, name: &str, ) -> Result<T, PgFutureErr>

Auto-unpack the column value.

Source

pub fn to_json(&self) -> Result<Json, PgFutureErr>

Converts the row into JSON, {$name: $value, …}.

Auto Trait Implementations§

§

impl<'a> Freeze for PgRow<'a>

§

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§

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, 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, 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.