PgRow

Trait PgRow 

Source
pub trait PgRow {
    // Required methods
    fn get_value<T>(&self, column: &str) -> PgResult<T>
       where T: for<'a> FromSql<'a>;
    fn get_opt<T>(&self, column: &str) -> PgResult<Option<T>>
       where T: for<'a> FromSql<'a>;
    fn try_get<T>(&self, column: &str) -> Option<T>
       where T: for<'a> FromSql<'a>;
}
Expand description

Extension trait for PostgreSQL rows.

Required Methods§

Source

fn get_value<T>(&self, column: &str) -> PgResult<T>
where T: for<'a> FromSql<'a>,

Get a column value by name.

Source

fn get_opt<T>(&self, column: &str) -> PgResult<Option<T>>
where T: for<'a> FromSql<'a>,

Get an optional column value by name.

Source

fn try_get<T>(&self, column: &str) -> Option<T>
where T: for<'a> FromSql<'a>,

Try to get a column value, returning None if the column doesn’t exist.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl PgRow for Row

Source§

fn get_value<T>(&self, column: &str) -> PgResult<T>
where T: for<'a> FromSql<'a>,

Source§

fn get_opt<T>(&self, column: &str) -> PgResult<Option<T>>
where T: for<'a> FromSql<'a>,

Source§

fn try_get<T>(&self, column: &str) -> Option<T>
where T: for<'a> FromSql<'a>,

Implementors§