pub struct Row<L>(/* private fields */);Expand description
A decoded row. Its fields are fixed by the query’s selection list, and each is read by the same value that selected it.
Implementations§
Source§impl<L> Row<L>
impl<L> Row<L>
Sourcepub fn fields(&self) -> &L
pub fn fields(&self) -> &L
The row’s fields as a RowCons chain, for walking it from another
crate. get/take/into_struct cover reading a known field; this
is for code that has to visit every field it happens to hold.
Sourcepub fn get<K: LookupKey, Idx>(
&self,
_key: K,
) -> &<L as Field<K::Key, Idx>>::Value
pub fn get<K: LookupKey, Idx>( &self, _key: K, ) -> &<L as Field<K::Key, Idx>>::Value
row.get(users::email) — the key is the same value that appeared in
the selection list, so there is no name to keep in sync and no
position to get wrong.
Sourcepub fn take<K: LookupKey, Idx>(
self,
_key: K,
) -> (<L as Field<K::Key, Idx>>::Value, Row<<L as Field<K::Key, Idx>>::Rest>)
pub fn take<K: LookupKey, Idx>( self, _key: K, ) -> (<L as Field<K::Key, Idx>>::Value, Row<<L as Field<K::Key, Idx>>::Rest>)
Moves one field out and hands back the row without it, so several fields can be taken in turn.
Sourcepub fn into_struct<T, Idxs>(self) -> Twhere
T: FromRow<L, Idxs>,
pub fn into_struct<T, Idxs>(self) -> Twhere
T: FromRow<L, Idxs>,
Builds a #[derive(FromRow)] struct out of this row, matching its
fields by name. Extra columns in the row are ignored, and the order
they were selected in doesn’t matter.
Sourcepub fn into_tuple(self) -> L::Valueswhere
L: RowValues,
pub fn into_tuple(self) -> L::Valueswhere
L: RowValues,
The positional view: the plain tuple this selection would decode to if rows didn’t exist.