pub struct LoadBuilder<E: Executor, P: Default + 'static> { /* private fields */ }Expand description
Builder for loading the projection state of a specific aggregate id.
Created via Projection::load. Allows registering related aggregates
whose events also feed this projection, then LoadBuilder::execute runs
the load.
Implementations§
Source§impl<E: Executor, P: Snapshot<E> + Default + 'static> LoadBuilder<E, P>
impl<E: Executor, P: Snapshot<E> + Default + 'static> LoadBuilder<E, P>
Sourcepub fn aggregate<A: Aggregate>(self, id: impl Into<String>) -> Self
pub fn aggregate<A: Aggregate>(self, id: impl Into<String>) -> Self
Adds a related aggregate to load events from.
Sourcepub fn aggregate_raw(
self,
aggregate_type: impl Into<String>,
id: impl Into<String>,
) -> Self
pub fn aggregate_raw( self, aggregate_type: impl Into<String>, id: impl Into<String>, ) -> Self
Adds a related aggregate to load events from (raw aggregate type).
Sourcepub async fn execute(&self, executor: &E) -> Result<Option<P>>
pub async fn execute(&self, executor: &E) -> Result<Option<P>>
Executes the load, returning the rebuilt state.
Returns None if no events exist for the aggregate, or if a tombstone
was registered via Projection::tombstone and the corresponding
event has been committed for this id.
Returns Err if there are too many events to process in one batch.
Auto Trait Implementations§
impl<E, P> !RefUnwindSafe for LoadBuilder<E, P>
impl<E, P> !UnwindSafe for LoadBuilder<E, P>
impl<E, P> Freeze for LoadBuilder<E, P>
impl<E, P> Send for LoadBuilder<E, P>
impl<E, P> Sync for LoadBuilder<E, P>
impl<E, P> Unpin for LoadBuilder<E, P>where
E: Unpin,
impl<E, P> UnsafeUnpin for LoadBuilder<E, P>
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