Struct pg_async::PgResult
[−]
[src]
pub struct PgResult { pub res: *mut PGresult, pub rows: u32, pub columns: u32, }
Fields
res: *mut PGresult
rows: u32
columns: u32
Methods
impl PgResult
[src]
fn is_empty(&self) -> bool
True if there are no rows in the result.
fn len(&self) -> u32
Number of rows.
fn ftype(&self, column: u32) -> Oid
PostgreSQL internal OID number of the column type.
fn fname<'a>(&'a self, column: u32) -> Result<&'a str, Utf8Error>
Returns the column name associated with the given column number. Column numbers start at 0.
fn row(&self, row: u32) -> PgRow
fn iter<'a>(&'a self) -> PgResultIt<'a>
Iterator over result rows.
fn to_json(&self) -> Result<Json, PgFutureErr>
Converts a PostgreSQL query result into a JSON array of rows, [{$name: $value, ...}, ...].
fn deserialize<T: DeserializeOwned>(&self) -> Result<Vec<T>, PgFutureErr>
Auto-unpack results.
#[derive(Deserialize)] struct Bar {id: i64} impl Bar { fn load() -> Box<Future<Item=Vec<Bar>, Error=PgFutureErr>> { Box::new (PGA.execute ("SELECT id FROM bars") .and_then (|pr| pr[0].deserialize())) } }