[][src]Trait domain_patterns::models::AggregateRoot

pub trait AggregateRoot: Entity {
    type Events: DomainEvent;
    type Error;
    fn version(&self) -> u64;

    fn next_version(&self) -> u64 { ... }
}

Associated Types

type Events: DomainEvent

This type alias should point to an enum of events that the aggregate root will create and publish.

type Error

This type alias should point to the root error type for the crate.

Loading content...

Required methods

fn version(&self) -> u64

version is a simple integers that is incremented for every mutation. This allows us to have something like an EntityCreated event where we can pass versions in, and re-order the events for playback in the correct order.

Loading content...

Provided methods

fn next_version(&self) -> u64

next_version simply returns the current version incremented by 1. This default implementation should never have to be overriden.

Loading content...

Implementors

Loading content...