Repository

Trait Repository 

Source
pub trait Repository<AR: AggregateRoot> {
    // Required methods
    fn load(&self, id: AR::Id) -> Result<AR>;
    fn save(&self, root: &mut AR) -> Result<()>;
}
Expand description

Repository returns AggregateRoot to a client. Repository should not be invoked on Entity.

Required Methods§

Source

fn load(&self, id: AR::Id) -> Result<AR>

load Event Sourced AggregateRoot from EventStore.

Source

fn save(&self, root: &mut AR) -> Result<()>

save Event Sourced AggregateRoot as DomainEvent Stream and increment EA Version. NOTE: don’t forget invoke clear_events method of AggregateRoot after save to Event Store.

Implementors§