[go: up one dir, main page]

Struct postgres::rows::Row [] [src]

pub struct Row<'a> {
    // some fields omitted
}

A single result row of a query.

Methods

impl<'a> Row<'a>
[src]

fn len(&self) -> usize

Returns the number of values in the row.

fn columns(&self) -> &'a [Column]

Returns a slice describing the columns of the Row.

fn get_opt<I, T>(&self, idx: I) -> Result<T> where I: RowIndex, T: FromSql

Retrieves the contents of a field of the row.

A field can be accessed by the name or index of its column, though access by index is more efficient. Rows are 0-indexed.

Returns an Error value if the index does not reference a column or the return type is not compatible with the Postgres type.

fn get<I, T>(&self, idx: I) -> T where I: RowIndex + Debug + Clone, T: FromSql

Retrieves the contents of a field of the row.

A field can be accessed by the name or index of its column, though access by index is more efficient. Rows are 0-indexed.

Panics

Panics if the index does not reference a column or the return type is not compatible with the Postgres type.

Example

let foo: i32 = row.get(0);
let bar: String = row.get("bar");

fn get_bytes<I>(&self, idx: I) -> Option<&[u8]> where I: RowIndex + Debug

Retrieves the specified field as a raw buffer of Postgres data.

Panics

Panics if the index does not reference a column.

Trait Implementations

impl<'a> Debug for Row<'a>
[src]

fn fmt(&self, fmt: &mut Formatter) -> Result

Formats the value using the given formatter.