pub struct AggregateBuilder<'a, R, A> { /* private fields */ }Expand description
Builder for loading aggregates by ID.
Implementations§
Source§impl<S, C, A> AggregateBuilder<'_, Repository<S, C, NoSnapshots<S::Id, S::Position>>, A>
impl<S, C, A> AggregateBuilder<'_, Repository<S, C, NoSnapshots<S::Id, S::Position>>, A>
Sourcepub async fn load(
self,
id: &S::Id,
) -> Result<A, ProjectionError<S::Error, <S::Codec as Codec>::Error>>where
A::Event: ProjectionEvent,
pub async fn load(
self,
id: &S::Id,
) -> Result<A, ProjectionError<S::Error, <S::Codec as Codec>::Error>>where
A::Event: ProjectionEvent,
Load the aggregate instance by replaying events (no snapshots).
The event kinds to load are automatically determined from the
aggregate’s event type via ProjectionEvent::EVENT_KINDS.
§Errors
Returns an error if the store fails to load events or if events cannot be deserialized.
Source§impl<S, SS, C, A> AggregateBuilder<'_, Repository<S, C, Snapshots<SS>>, A>where
S: EventStore,
SS: SnapshotStore<Id = S::Id, Position = S::Position>,
C: ConcurrencyStrategy,
A: Aggregate<Id = S::Id> + Serialize + DeserializeOwned,
impl<S, SS, C, A> AggregateBuilder<'_, Repository<S, C, Snapshots<SS>>, A>where
S: EventStore,
SS: SnapshotStore<Id = S::Id, Position = S::Position>,
C: ConcurrencyStrategy,
A: Aggregate<Id = S::Id> + Serialize + DeserializeOwned,
Sourcepub async fn load(
self,
id: &S::Id,
) -> Result<A, ProjectionError<S::Error, <S::Codec as Codec>::Error>>where
A::Event: ProjectionEvent,
pub async fn load(
self,
id: &S::Id,
) -> Result<A, ProjectionError<S::Error, <S::Codec as Codec>::Error>>where
A::Event: ProjectionEvent,
Load the aggregate instance using snapshots when available.
The event kinds to load are automatically determined from the
aggregate’s event type via ProjectionEvent::EVENT_KINDS.
§Errors
Returns an error if events cannot be deserialized or a stored snapshot cannot be deserialized (which indicates snapshot data corruption).
Auto Trait Implementations§
impl<'a, R, A> Freeze for AggregateBuilder<'a, R, A>
impl<'a, R, A> RefUnwindSafe for AggregateBuilder<'a, R, A>where
R: RefUnwindSafe,
impl<'a, R, A> Send for AggregateBuilder<'a, R, A>where
R: Sync,
impl<'a, R, A> Sync for AggregateBuilder<'a, R, A>where
R: Sync,
impl<'a, R, A> Unpin for AggregateBuilder<'a, R, A>
impl<'a, R, A> UnwindSafe for AggregateBuilder<'a, R, A>where
R: RefUnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more