Trait AggregateCommand

Source
pub trait AggregateCommand<A: Aggregate> {
    type Event: AggregateEvent<A>;
    type Events: Events<ProducedEvent<A, Self>>;
    type Error: CqrsError;

    // Required method
    fn execute_on(self, aggregate: &A) -> Result<Self::Events, Self::Error>;
}
Expand description

A command that can be executed against an aggregate.

Required Associated Types§

Source

type Event: AggregateEvent<A>

The type of event that is produced by this command.

Source

type Events: Events<ProducedEvent<A, Self>>

The type of the sequence of events generated when the command is executed successfully.

Source

type Error: CqrsError

The error type.

Required Methods§

Source

fn execute_on(self, aggregate: &A) -> Result<Self::Events, Self::Error>

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.

Implementors§