Skip to main content

SessionLoadQuery

Struct SessionLoadQuery 

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

SessionLoadQuery

Session-bound fluent wrapper for load queries.

Implementations§

Source§

impl<C: CanisterKind, E: EntityKind<Canister = C>> SessionLoadQuery<'_, C, E>

Source

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

Source

pub fn by_id(self, id: Id<E>) -> Self

Filter by a single typed primary-key value.

Id<E> is a public identifier and is treated as untrusted input until verified by explicit existence/authorization checks in caller policy.

Source

pub fn by_ids<I>(self, ids: I) -> Self
where I: IntoIterator<Item = Id<E>>,

Load multiple entities by typed primary-key values.

IDs are correlation/lookup values only and do not grant authority.

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Bound the number of returned rows.

Pagination is only valid with explicit ordering; combine limit and/or offset with order_by(...) or planning fails.

Source

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

Skip a number of rows in the ordered result stream.

Pagination is only valid with explicit ordering; combine offset and/or limit with order_by(...) or planning fails.

Source

pub fn is_empty(&self) -> Result<bool, Error>
where E: EntityValue,

Source

pub fn count(&self) -> Result<u32, Error>
where E: EntityValue,

Source

pub fn execute(&self) -> Result<Response<E>, Error>
where E: EntityValue,

Source

pub fn require_one(&self) -> Result<(), Error>
where E: EntityValue,

Source

pub fn require_some(&self) -> Result<(), Error>
where E: EntityValue,

Source

pub fn row(&self) -> Result<Row<E>, Error>
where E: EntityValue,

Source

pub fn try_row(&self) -> Result<Option<Row<E>>, Error>
where E: EntityValue,

Source

pub fn rows(&self) -> Result<Vec<Row<E>>, Error>
where E: EntityValue,

Source

pub fn id(&self) -> Result<Option<Id<E>>, Error>
where E: EntityValue,

Source

pub fn require_id(&self) -> Result<Id<E>, Error>
where E: EntityValue,

Source

pub fn try_id(&self) -> Result<Option<Id<E>>, Error>
where E: EntityValue,

Source

pub fn ids(&self) -> Result<Vec<Id<E>>, Error>
where E: EntityValue,

Source

pub fn contains_id(&self, id: &Id<E>) -> Result<bool, Error>
where E: EntityValue,

Source

pub fn entity(&self) -> Result<E, Error>
where E: EntityValue,

Source

pub fn try_entity(&self) -> Result<Option<E>, Error>
where E: EntityValue,

Source

pub fn entities(&self) -> Result<Vec<E>, Error>
where E: EntityValue,

Source

pub fn view(&self) -> Result<<E as AsView>::ViewType, Error>
where E: EntityValue,

Source

pub fn view_opt(&self) -> Result<Option<<E as AsView>::ViewType>, Error>
where E: EntityValue,

Source

pub fn views(&self) -> Result<Vec<<E as AsView>::ViewType>, Error>
where E: EntityValue,

Source

pub fn group_count_by<K>( self, key: impl Fn(&E) -> K, ) -> Result<HashMap<K, u32>, Error>
where E: EntityValue, K: Eq + Hash,

Source

pub fn one(&self) -> Result<E, Error>
where E: EntityValue,

Source

pub fn one_opt(&self) -> Result<Option<E>, Error>
where E: EntityValue,

Source

pub fn all(&self) -> Result<Vec<E>, Error>
where E: EntityValue,

Source§

impl<C: CanisterKind, E: EntityKind<Canister = C> + SingletonEntity> SessionLoadQuery<'_, C, E>

Source

pub fn only(self) -> Self
where E::Key: Default,

Load the singleton entity.

Auto Trait Implementations§

§

impl<'a, C, E> Freeze for SessionLoadQuery<'a, C, E>
where <E as EntityKey>::Key: Freeze,

§

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

§

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

§

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

§

impl<'a, C, E> Unpin for SessionLoadQuery<'a, C, E>
where E: Unpin, <E as EntityKey>::Key: Unpin,

§

impl<'a, C, E> !UnwindSafe for SessionLoadQuery<'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