ReadModelProjection

Trait ReadModelProjection 

Source
pub trait ReadModelProjection: Send + Sync {
    type Event: Send + Sync;

    // Required methods
    fn handle_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 Self::Event,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn projection_name(&self) -> &str;
    fn reset<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Read model projection trait for updating read models from events

Required Associated Types§

Required Methods§

Source

fn handle_event<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 Self::Event, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle an event and update the read model

Source

fn projection_name(&self) -> &str

Get the projection name for tracking progress

Source

fn reset<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reset the projection (for rebuilding)

Implementors§