Skip to content

eventually-core: add Projection trait #93

@ar3s3ru

Description

@ar3s3ru

Add support for projections by creating a Projection trait to define how to calculate the projection state based on the interested domain events and previous state:

pub trait Projection: Default { // There must be a default state
    type Event;
    type Error;

    // Projections are always applied to persisted events coming from the Subscription.
    fn project(self, event: store::Persisted<Self::Event>) -> Result<Self, Self::Error>;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    eventually-coreIssue or Pull Request involves eventually-core crateeventually-utilIssue or Pull Request involves eventually-util cratefeatureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions