event_hex 0.0.3

A pragmatic Rust toolkit for Domain-Driven Design with first-class support for event sourcing and CQRS.
Documentation
use crate::projection::ProjectionRepository;
use std::sync::Arc;
use tokio::sync::RwLock;

#[derive(Clone, Debug)]
pub struct ProjectionUpdaterEventHandler {
    pub repository: Arc<RwLock<dyn ProjectionRepository>>,
}

impl ProjectionUpdaterEventHandler {
    pub fn new(repository: Arc<RwLock<dyn ProjectionRepository>>) -> Self {
        Self { repository }
    }
}

// Factory for updating any projections.
// If needed, fields can be added, e.g., context
pub struct ProjectionUpdaterEventHandlerFactory;

impl ProjectionUpdaterEventHandlerFactory {
    pub fn new() -> Self {
        Self
    }
}

impl Default for ProjectionUpdaterEventHandlerFactory {
    fn default() -> Self {
        Self::new()
    }
}