pub struct Response<E: EntityKind>(pub Vec<(Key, E)>);Expand description
Response
Materialized query result: ordered (Key, Entity) pairs.
Tuple Fields§
§0: Vec<(Key, E)>Implementations§
Source§impl<E: EntityKind> Response<E>
impl<E: EntityKind> Response<E>
Sourcepub fn one_entity(self) -> Result<E, Error>
pub fn one_entity(self) -> Result<E, Error>
Require exactly one entity.
Sourcepub fn one_opt_entity(self) -> Result<Option<E>, Error>
pub fn one_opt_entity(self) -> Result<Option<E>, Error>
Require at most one entity.
Sourcepub fn one_opt_key(self) -> Result<Option<Key>, Error>
pub fn one_opt_key(self) -> Result<Option<Key>, Error>
Require at most one row and return its key.
pub fn contains_key(&self, key: &Key) -> bool
Sourcepub fn pk(&self) -> Option<E::PrimaryKey>
pub fn pk(&self) -> Option<E::PrimaryKey>
First primary key in the response, if present.
Sourcepub fn pks(&self) -> Vec<E::PrimaryKey>
pub fn pks(&self) -> Vec<E::PrimaryKey>
Collect all primary keys in order.
Sourcepub fn pks_iter(self) -> impl Iterator<Item = E::PrimaryKey>
pub fn pks_iter(self) -> impl Iterator<Item = E::PrimaryKey>
Iterate primary keys without cloning entities.
pub fn one_pk(self) -> Result<E::PrimaryKey, Error>
pub fn one_opt_pk(self) -> Result<Option<E::PrimaryKey>, Error>
Sourcepub fn entities_iter(self) -> impl Iterator<Item = E>
pub fn entities_iter(self) -> impl Iterator<Item = E>
Iterate entities without materializing a Vec.
Sourcepub fn view(self) -> Option<E::ViewType>
pub fn view(self) -> Option<E::ViewType>
Convert the first entity to its view type, if present.
Sourcepub fn views(self) -> Vec<E::ViewType>
pub fn views(self) -> Vec<E::ViewType>
Convert all entities to their view types and collect them.
Sourcepub fn views_iter(self) -> impl Iterator<Item = E::ViewType>
pub fn views_iter(self) -> impl Iterator<Item = E::ViewType>
Iterate over view types without cloning entities.
Trait Implementations§
Source§impl<E: EntityKind> IntoIterator for Response<E>
impl<E: EntityKind> IntoIterator for Response<E>
Auto Trait Implementations§
impl<E> Freeze for Response<E>
impl<E> RefUnwindSafe for Response<E>where
E: RefUnwindSafe,
impl<E> Send for Response<E>where
E: Send,
impl<E> Sync for Response<E>where
E: Sync,
impl<E> Unpin for Response<E>where
E: Unpin,
impl<E> UnwindSafe for Response<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more