[][src]Trait cqrs_core::Aggregate

pub trait Aggregate: Default {
    fn aggregate_type() -> &'static str;

    fn apply<E>(&mut self, event: E)
    where
        E: AggregateEvent<Self>
, { ... }
fn execute<C>(&self, command: C) -> Result<C::Events, C::Error>
    where
        C: AggregateCommand<Self>
, { ... } }

A projected state built from a series of events.

Required methods

fn aggregate_type() -> &'static str

A static string representing the type of the aggregate.

Note: This should effectively be a constant value, and should never change.

Loading content...

Provided methods

fn apply<E>(&mut self, event: E) where
    E: AggregateEvent<Self>, 

Consumes the event, applying its effects to the aggregate.

fn execute<C>(&self, command: C) -> Result<C::Events, C::Error> where
    C: AggregateCommand<Self>, 

Consumes a command, attempting to execute it against the aggregate. If the execution is successful, a sequence of events is generated, which can be applied to the aggregate.

Loading content...

Implementors

Loading content...