pub struct Row<'stmt> { /* private fields */ }
Expand description
A single result row of a query.
Implementations§
source§impl<'stmt> Row<'stmt>
impl<'stmt> Row<'stmt>
sourcepub fn get_unwrap<I: RowIndex, T: FromSql>(&self, idx: I) -> T
pub fn get_unwrap<I: RowIndex, T: FromSql>(&self, idx: I) -> T
Get the value of a particular column of the result row.
§Panics
Panics if calling row.get(idx)
would return an error,
including:
- If the underlying SQLite column type is not a valid type as a source
for
T
- If the underlying SQLite integral value is outside the range
representable by
T
- If
idx
is outside the range of columns in the returned query
sourcepub fn get<I: RowIndex, T: FromSql>(&self, idx: I) -> Result<T>
pub fn get<I: RowIndex, T: FromSql>(&self, idx: I) -> Result<T>
Get the value of a particular column of the result row.
§Failure
Returns an Error::InvalidColumnType
if the underlying SQLite column
type is not a valid type as a source for T
.
Returns an Error::InvalidColumnIndex
if idx
is outside the valid
column range for this row.
Returns an Error::InvalidColumnName
if idx
is not a valid column
name for this row.
If the result type is i128 (which requires the i128_blob
feature to be
enabled), and the underlying SQLite column is a blob whose size is not
16 bytes, Error::InvalidColumnType
will also be returned.
sourcepub fn get_ref<I: RowIndex>(&self, idx: I) -> Result<ValueRef<'_>>
pub fn get_ref<I: RowIndex>(&self, idx: I) -> Result<ValueRef<'_>>
Get the value of a particular column of the result row as a ValueRef
,
allowing data to be read out of a row without copying.
This ValueRef
is valid only as long as this Row, which is enforced by
it’s lifetime. This means that while this method is completely safe,
it can be somewhat difficult to use, and most callers will be better
served by get
or get_unwrap
.
§Failure
Returns an Error::InvalidColumnIndex
if idx
is outside the valid
column range for this row.
Returns an Error::InvalidColumnName
if idx
is not a valid column
name for this row.
sourcepub fn get_ref_unwrap<I: RowIndex>(&self, idx: I) -> ValueRef<'_>
pub fn get_ref_unwrap<I: RowIndex>(&self, idx: I) -> ValueRef<'_>
Get the value of a particular column of the result row as a ValueRef
,
allowing data to be read out of a row without copying.
This ValueRef
is valid only as long as this Row, which is enforced by
it’s lifetime. This means that while this method is completely safe,
it can be difficult to use, and most callers will be better served by
get
or get_unwrap
.
§Panics
Panics if calling row.get_ref(idx)
would return an
error, including:
- If
idx
is outside the range of columns in the returned query. - If
idx
is not a valid column name for this row.
Trait Implementations§
source§impl<'stmt> Debug for Row<'stmt>
impl<'stmt> Debug for Row<'stmt>
Debug Row
like an ordered Map<Result<&str>, Result<(Type, ValueRef)>>
with column name as key except that for Type::Blob
only its size is
printed (not its content).