Skip to main content

ProjectionAggregate

Trait ProjectionAggregate 

Source
pub trait ProjectionAggregate: ProjectionCursor {
    // Required method
    fn aggregate_id(&self) -> String;

    // Provided methods
    fn aggregate_version(&self) -> Result<u16> { ... }
    fn write(&self) -> Result<WriteBuilder> { ... }
}
Expand description

Trait for projections that can create a WriteBuilder.

Extends ProjectionCursor to provide aggregate identity and versioning, enabling projections to emit new events.

Required Methods§

Source

fn aggregate_id(&self) -> String

Returns the aggregate ID for this projection.

Implementors must return the stable identity of the aggregate this projection represents (typically a field populated from the first event).

Provided Methods§

Source

fn aggregate_version(&self) -> Result<u16>

Returns the current aggregate version from the cursor.

Returns 0 if no cursor is set.

Source

fn write(&self) -> Result<WriteBuilder>

Creates a WriteBuilder pre-configured with this projection’s ID and version.

Use this to emit new events from a projection (the write gateway).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§