pub struct SessionLoadQuery<'a, C: CanisterKind, E: EntityKind<Canister = C>> { /* private fields */ }Expand description
SessionLoadQuery
Fluent, session-bound load query wrapper that keeps intent pure
while routing execution through the DbSession boundary.
Implementations§
Source§impl<'a, C: CanisterKind, E: EntityKind<Canister = C>> SessionLoadQuery<'a, C, E>
impl<'a, C: CanisterKind, E: EntityKind<Canister = C>> SessionLoadQuery<'a, C, E>
Sourcepub fn many<I>(self, keys: I) -> Selfwhere
I: IntoIterator<Item = E::PrimaryKey>,
pub fn many<I>(self, keys: I) -> Selfwhere
I: IntoIterator<Item = E::PrimaryKey>,
Load multiple entities by primary key.
Semantics:
- Equivalent to
WHERE pk IN (…) - Uses key-based access (ByKey / ByKeys)
- Missing keys are ignored in MissingOk mode
- Strict mode treats missing rows as corruption
Sourcepub fn filter(self, predicate: Predicate) -> Self
pub fn filter(self, predicate: Predicate) -> Self
Add a predicate, implicitly AND-ing with any existing predicate.
Sourcepub fn filter_expr(self, expr: FilterExpr) -> Result<Self, QueryError>
pub fn filter_expr(self, expr: FilterExpr) -> Result<Self, QueryError>
Apply a dynamic filter expression.
Sourcepub fn sort_expr(self, expr: SortExpr) -> Result<Self, QueryError>
pub fn sort_expr(self, expr: SortExpr) -> Result<Self, QueryError>
Apply a dynamic sort expression.
Sourcepub fn order_by_desc(self, field: impl AsRef<str>) -> Self
pub fn order_by_desc(self, field: impl AsRef<str>) -> Self
Append a descending sort key.
Sourcepub fn explain(&self) -> Result<ExplainPlan, QueryError>
pub fn explain(&self) -> Result<ExplainPlan, QueryError>
Explain this query without executing it.
Sourcepub fn plan(&self) -> Result<ExecutablePlan<E>, QueryError>
pub fn plan(&self) -> Result<ExecutablePlan<E>, QueryError>
Plan this query into an executor-ready plan.
Sourcepub fn execute(&self) -> Result<Response<E>, QueryError>
pub fn execute(&self) -> Result<Response<E>, QueryError>
Execute this query using the session’s policy settings.
Sourcepub fn exists(&self) -> Result<bool, QueryError>
pub fn exists(&self) -> Result<bool, QueryError>
Return whether any rows match this query.
Sourcepub fn count(&self) -> Result<u64, QueryError>
pub fn count(&self) -> Result<u64, QueryError>
Execute and return the number of matching rows.
Sourcepub fn all(&self) -> Result<Vec<E>, QueryError>
pub fn all(&self) -> Result<Vec<E>, QueryError>
Execute and return all entities.
Sourcepub fn views(&self) -> Result<Vec<View<E>>, QueryError>
pub fn views(&self) -> Result<Vec<View<E>>, QueryError>
Execute and return all results as views.
Sourcepub fn one(&self) -> Result<E, QueryError>
pub fn one(&self) -> Result<E, QueryError>
Execute and require exactly one entity.
Sourcepub fn view(&self) -> Result<View<E>, QueryError>
pub fn view(&self) -> Result<View<E>, QueryError>
Execute and require exactly one view.
Sourcepub fn one_opt(&self) -> Result<Option<E>, QueryError>
pub fn one_opt(&self) -> Result<Option<E>, QueryError>
Execute and return zero or one entity.