pub struct Row { /* private fields */ }Expand description
A row of data returned from the database by a query.
Implementations§
Source§impl Row
impl Row
Sourcepub fn get<'a, I, T>(&'a self, idx: I) -> T
pub fn get<'a, I, T>(&'a self, idx: I) -> T
Deserializes a value from the row.
The value can be specified either by its numeric index in the row, or by its column name.
§Panics
Panics if the index is out of bounds or if the value cannot be converted to the specified type.
Sourcepub fn try_get<'a, I, T>(&'a self, idx: I) -> Result<T, Error>
pub fn try_get<'a, I, T>(&'a self, idx: I) -> Result<T, Error>
Like Row::get, but returns a Result rather than panicking.
Sourcepub fn format(&self, idx: usize) -> ResultFormat
pub fn format(&self, idx: usize) -> ResultFormat
Returns the format the value of the column at the given index came in,
as the query asked for it: see Client::query_raw_with_formats.
get and try_get decode a column as binary whatever its format, so
read a text column with col_buffer.
§Panics
Panics if the index is out of bounds.
Sourcepub fn col_buffer(&self, idx: usize) -> Option<&[u8]>
pub fn col_buffer(&self, idx: usize) -> Option<&[u8]>
Returns the raw bytes for the column at the given index.
Returns None if the value is SQL NULL.
With ResultFormat::Text, the bytes are the UTF-8 text representation
of the value — the same format PostgreSQL sends to text-mode clients.
With ResultFormat::Binary, the bytes are binary-encoded. format
says which the column is in.