Skip to main content

SessionDeleteQuery

Struct SessionDeleteQuery 

Source
pub struct SessionDeleteQuery<'a, C: CanisterKind, E: EntityKind<Canister = C>> { /* private fields */ }
Expand description

SessionDeleteQuery

Fluent, session-bound delete query wrapper that keeps query intent pure while routing execution through the DbSession boundary.

Implementations§

Source§

impl<'a, C: CanisterKind, E: EntityKind<Canister = C>> SessionDeleteQuery<'a, C, E>

Source

pub const fn query(&self) -> &Query<E>

Return a reference to the underlying query intent.

Source

pub fn by_key(self, key: impl Into<Key>) -> Self

Delete by primary key.

Source

pub fn many<I>(self, keys: I) -> Self
where I: IntoIterator<Item = E::PrimaryKey>,

Delete 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
  • Empty input yields a no-op delete
Source

pub fn filter(self, predicate: Predicate) -> Self

Add a predicate, implicitly AND-ing with any existing predicate.

Source

pub fn filter_expr(self, expr: FilterExpr) -> Result<Self, QueryError>

Apply a dynamic filter expression.

Source

pub fn sort_expr(self, expr: SortExpr) -> Result<Self, QueryError>

Apply a dynamic sort expression.

Source

pub fn order_by(self, field: impl AsRef<str>) -> Self

Append an ascending sort key.

Source

pub fn order_by_desc(self, field: impl AsRef<str>) -> Self

Append a descending sort key.

Source

pub fn limit(self, limit: u32) -> Self

Apply a delete limit to bound mutation size.

Source

pub fn explain(&self) -> Result<ExplainPlan, QueryError>

Explain this query without executing it.

Source

pub fn plan(&self) -> Result<ExecutablePlan<E>, QueryError>

Plan this query into an executor-ready plan.

Source

pub fn execute(&self) -> Result<Response<E>, QueryError>

Execute this delete using the session’s policy settings.

Source

pub fn is_empty(&self) -> Result<bool, QueryError>

Execute and return whether the response is empty.

Source

pub fn count(&self) -> Result<u32, QueryError>

Execute and return the number of affected rows.

Source

pub fn require_one(&self) -> Result<(), QueryError>

Execute and require exactly one row.

Source

pub fn require_some(&self) -> Result<(), QueryError>

Execute and require at least one row.

Source

pub fn row(&self) -> Result<Row<E>, QueryError>

Execute and return the single row.

Source

pub fn try_row(&self) -> Result<Option<Row<E>>, QueryError>

Execute and return zero or one row.

Source

pub fn rows(&self) -> Result<Vec<Row<E>>, QueryError>

Execute and return all rows.

Source

pub fn entity(&self) -> Result<E, QueryError>

Execute and return the single entity.

Source

pub fn try_entity(&self) -> Result<Option<E>, QueryError>

Execute and return zero or one entity.

Source

pub fn entities(&self) -> Result<Vec<E>, QueryError>

Execute and return all entities.

Source

pub fn key(&self) -> Result<Option<Key>, QueryError>

Execute and return the first store key, if any.

Source

pub fn key_strict(&self) -> Result<Key, QueryError>

Execute and require exactly one store key.

Source

pub fn try_key(&self) -> Result<Option<Key>, QueryError>

Execute and return zero or one store key.

Source

pub fn keys(&self) -> Result<Vec<Key>, QueryError>

Execute and return all store keys.

Source

pub fn contains_key(&self, key: &Key) -> Result<bool, QueryError>

Execute and check whether the response contains the provided key.

Source

pub fn primary_key(&self) -> Result<E::PrimaryKey, QueryError>

Execute and require exactly one primary key.

Source

pub fn try_primary_key(&self) -> Result<Option<E::PrimaryKey>, QueryError>

Execute and return zero or one primary key.

Source

pub fn primary_keys(&self) -> Result<Vec<E::PrimaryKey>, QueryError>

Execute and return all primary keys.

Source

pub fn view(&self) -> Result<View<E>, QueryError>

Execute and return the single view.

Source

pub fn view_opt(&self) -> Result<Option<View<E>>, QueryError>

Execute and return zero or one view.

Source

pub fn views(&self) -> Result<Vec<View<E>>, QueryError>

Execute and return all views.

Source

pub fn delete_rows(&self) -> Result<Response<E>, QueryError>

Execute a delete query and return the deleted rows.

Source§

impl<C: CanisterKind, E: EntityKind<Canister = C>> SessionDeleteQuery<'_, C, E>
where E::PrimaryKey: UnitKey,

Source

pub fn only(self) -> Self

Delete the singleton entity identified by the unit primary key ().

Semantics:

  • Equivalent to DELETE … WHERE pk = ()
  • Uses key-based access (ByKey)
  • MissingOk mode is idempotent
  • Strict mode treats missing row as corruption

Auto Trait Implementations§

§

impl<'a, C, E> Freeze for SessionDeleteQuery<'a, C, E>

§

impl<'a, C, E> !RefUnwindSafe for SessionDeleteQuery<'a, C, E>

§

impl<'a, C, E> !Send for SessionDeleteQuery<'a, C, E>

§

impl<'a, C, E> !Sync for SessionDeleteQuery<'a, C, E>

§

impl<'a, C, E> Unpin for SessionDeleteQuery<'a, C, E>
where E: Unpin,

§

impl<'a, C, E> UnsafeUnpin for SessionDeleteQuery<'a, C, E>

§

impl<'a, C, E> !UnwindSafe for SessionDeleteQuery<'a, C, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V