[−][src]Struct eventually::Repository
Implementation of the Repository pattern for storing, retrieving
and deleting Aggregates.
A Repository instruments an EventStore to:
- Insert
Events in theEventStorefor an Aggregate, using theAggregateRoot, - Get all the
Events in theEventStoreand rebuild theStateof an Aggregate, into a newAggregateRootinstance, - Remove all the
Events for an Aggregate in theEventStore.
Implementations
impl<T, Store> Repository<T, Store> where
Store: EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
T: Aggregate + Clone, [src]
Store: EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
T: Aggregate + Clone,
pub fn new(
builder: AggregateRootBuilder<T>,
store: Store
) -> Repository<T, Store>[src]
builder: AggregateRootBuilder<T>,
store: Store
) -> Repository<T, Store>
Creates a new Repository instance, using the Aggregate
and EventStore provided.
impl<T, Store> Repository<T, Store> where
Store: EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
T: Aggregate + Clone,
<T as Aggregate>::Id: Clone,
<T as Aggregate>::Event: Clone,
<T as Aggregate>::Error: Error,
<T as Aggregate>::Error: 'static,
<Store as EventStore>::Error: Error,
<Store as EventStore>::Error: 'static, [src]
Store: EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
T: Aggregate + Clone,
<T as Aggregate>::Id: Clone,
<T as Aggregate>::Event: Clone,
<T as Aggregate>::Error: Error,
<T as Aggregate>::Error: 'static,
<Store as EventStore>::Error: Error,
<Store as EventStore>::Error: 'static,
pub async fn get(
&'_ self,
id: <T as Aggregate>::Id
) -> Result<AggregateRoot<T>, Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>[src]
&'_ self,
id: <T as Aggregate>::Id
) -> Result<AggregateRoot<T>, Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>
Returns the Aggregate from the Repository with the specified id,
if any.
In case the Aggregate with the specified id exists, returns
a new AggregateRoot instance with its latest State.
Otherwise, None is returned.
pub async fn add(
&'_ mut self,
__arg1: AggregateRoot<T>
) -> Result<AggregateRoot<T>, Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>[src]
&'_ mut self,
__arg1: AggregateRoot<T>
) -> Result<AggregateRoot<T>, Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>
Adds a new State of the Aggregate into the Repository,
through an AggregateRoot instance.
Returns Error::NoEvents if there are no Events to commit
in the AggregateRoot.
pub async fn remove(
&'_ mut self,
id: <T as Aggregate>::Id
) -> Result<(), Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>[src]
&'_ mut self,
id: <T as Aggregate>::Id
) -> Result<(), Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>
Removes the specified Aggregate from the Repository,
using the provided AggregateId.
Trait Implementations
impl<T, Store> Clone for Repository<T, Store> where
Store: Clone + EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
T: Aggregate + Clone + 'static, [src]
Store: Clone + EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
T: Aggregate + Clone + 'static,
fn clone(&self) -> Repository<T, Store>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Auto Trait Implementations
impl<T, Store> RefUnwindSafe for Repository<T, Store> where
Store: RefUnwindSafe,
T: RefUnwindSafe,
Store: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, Store> Send for Repository<T, Store> where
Store: Send,
T: Send,
Store: Send,
T: Send,
impl<T, Store> Sync for Repository<T, Store> where
Store: Sync,
T: Sync,
Store: Sync,
T: Sync,
impl<T, Store> Unpin for Repository<T, Store> where
Store: Unpin,
T: Unpin,
Store: Unpin,
T: Unpin,
impl<T, Store> UnwindSafe for Repository<T, Store> where
Store: UnwindSafe,
T: UnwindSafe,
Store: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,