pub struct Row { /* private fields */ }Expand description
One result row.
Column values are borrowed slices of the received frame, so a row can be cheaply cloned and kept beyond its originating query.
Implementations§
Source§impl Row
impl Row
Sourcepub fn try_get<T: FromSql>(&self, name: &str) -> Result<T, Error>
pub fn try_get<T: FromSql>(&self, name: &str) -> Result<T, Error>
Decodes the column named name.
§Errors
Returns Error::ColumnNotFound if the name is unknown,
Error::UnexpectedNull if the column is NULL and T is not
Option, or a decode error if the bytes are malformed.
Sourcepub fn try_get_by_index<T: FromSql>(&self, index: usize) -> Result<T, Error>
pub fn try_get_by_index<T: FromSql>(&self, index: usize) -> Result<T, Error>
Decodes the column at index.
§Errors
Returns Error::ColumnNotFound if the index is out of range,
Error::UnexpectedNull if the column is NULL and T is not
Option, Error::Decode if the column’s type cannot be decoded as
T, or a decode error if the bytes are malformed.
Sourcepub fn get_str<'a>(&'a self, name: &str) -> Result<&'a str, Error>
pub fn get_str<'a>(&'a self, name: &str) -> Result<&'a str, Error>
Returns the named column as a borrowed UTF-8 string, without allocating.
§Errors
Returns Error::ColumnNotFound if the name is unknown,
Error::UnexpectedNull if the column is NULL, or a decode error if
the bytes are not valid UTF-8.