[][src]Struct eventually::Repository

pub struct Repository<T, Store> where
    Store: EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
    T: Aggregate + Clone + 'static, 
{ /* fields omitted */ }

Implementation of the Repository pattern for storing, retrieving and deleting Aggregates.

A Repository instruments an EventStore to:

Implementations

impl<T, Store> Repository<T, Store> where
    Store: EventStore<SourceId = <T as Aggregate>::Id, Event = <T as Aggregate>::Event>,
    T: Aggregate + Clone
[src]

pub fn new(
    builder: AggregateRootBuilder<T>,
    store: Store
) -> Repository<T, Store>
[src]

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: Debug,
    <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]

pub async fn get(
    &'_ self,
    id: <T as Aggregate>::Id
) -> Result<AggregateRoot<T>, Error<<T as Aggregate>::Error, <Store as EventStore>::Error>>
[src]

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]

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]

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]

Auto Trait Implementations

impl<T, Store> RefUnwindSafe for Repository<T, Store> where
    Store: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, Store> Send for Repository<T, Store> where
    Store: Send,
    T: Send

impl<T, Store> Sync for Repository<T, Store> where
    Store: Sync,
    T: Sync

impl<T, Store> Unpin for Repository<T, Store> where
    Store: Unpin,
    T: Unpin

impl<T, Store> UnwindSafe for Repository<T, Store> where
    Store: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.