pub struct LoadExecutor<E: EntityKind> { /* private fields */ }Expand description
LoadExecutor
Implementations§
Source§impl<E: EntityKind> LoadExecutor<E>
impl<E: EntityKind> LoadExecutor<E>
pub const fn new(db: Db<E::Canister>, debug: bool) -> Self
Sourcepub fn one(&self, value: impl FieldValue) -> Result<Response<E>, Error>
pub fn one(&self, value: impl FieldValue) -> Result<Response<E>, Error>
Execute a query for a single primary key.
Sourcepub fn many(
&self,
values: impl IntoIterator<Item = impl FieldValue>,
) -> Result<Response<E>, Error>
pub fn many( &self, values: impl IntoIterator<Item = impl FieldValue>, ) -> Result<Response<E>, Error>
Execute a query matching multiple primary keys.
Sourcepub fn filter<F, I>(&self, f: F) -> Result<Response<E>, Error>
pub fn filter<F, I>(&self, f: F) -> Result<Response<E>, Error>
Execute a query built from a filter.
Sourcepub fn require_one(&self, query: LoadQuery) -> Result<(), Error>
pub fn require_one(&self, query: LoadQuery) -> Result<(), Error>
Execute a query and require exactly one row.
Sourcepub fn require_one_pk(&self, value: impl FieldValue) -> Result<(), Error>
pub fn require_one_pk(&self, value: impl FieldValue) -> Result<(), Error>
Require exactly one row by primary key.
Sourcepub fn require_one_filter<F, I>(&self, f: F) -> Result<(), Error>
pub fn require_one_filter<F, I>(&self, f: F) -> Result<(), Error>
Require exactly one row from a filter.
Sourcepub fn exists(&self, query: LoadQuery) -> Result<bool, Error>
pub fn exists(&self, query: LoadQuery) -> Result<bool, Error>
Check whether at least one row matches the query.
Sourcepub fn exists_one(&self, value: impl FieldValue) -> Result<bool, Error>
pub fn exists_one(&self, value: impl FieldValue) -> Result<bool, Error>
Check existence by primary key.
Sourcepub fn exists_filter<F, I>(&self, f: F) -> Result<bool, Error>
pub fn exists_filter<F, I>(&self, f: F) -> Result<bool, Error>
Check existence with a filter.
Sourcepub fn exists_any(&self) -> Result<bool, Error>
pub fn exists_any(&self) -> Result<bool, Error>
Check whether the table contains any rows.
Sourcepub fn ensure_exists_one(&self, value: impl FieldValue) -> Result<(), Error>
pub fn ensure_exists_one(&self, value: impl FieldValue) -> Result<(), Error>
Require at least one row by primary key.
Sourcepub fn ensure_exists_filter<F, I>(&self, f: F) -> Result<(), Error>
pub fn ensure_exists_filter<F, I>(&self, f: F) -> Result<(), Error>
Require at least one row from a filter.
Sourcepub fn explain(self, query: LoadQuery) -> Result<QueryPlan, Error>
pub fn explain(self, query: LoadQuery) -> Result<QueryPlan, Error>
Validate and return the query plan without executing.
Sourcepub fn execute(&self, query: LoadQuery) -> Result<Response<E>, Error>
pub fn execute(&self, query: LoadQuery) -> Result<Response<E>, Error>
Execute a full query and return a collection of entities.
pub fn count_all(&self) -> Result<u32, Error>
Trait Implementations§
Source§impl<E: Clone + EntityKind> Clone for LoadExecutor<E>
impl<E: Clone + EntityKind> Clone for LoadExecutor<E>
Source§fn clone(&self) -> LoadExecutor<E>
fn clone(&self) -> LoadExecutor<E>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<E: Copy + EntityKind> Copy for LoadExecutor<E>
Auto Trait Implementations§
impl<E> Freeze for LoadExecutor<E>
impl<E> RefUnwindSafe for LoadExecutor<E>
impl<E> Send for LoadExecutor<E>
impl<E> Sync for LoadExecutor<E>
impl<E> Unpin for LoadExecutor<E>
impl<E> UnwindSafe for LoadExecutor<E>
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