use cqrs_core::{Aggregate, AggregateCommand, AggregateEvent, AggregateId, Event};
use void::Void;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct TestAggregate;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct TestEvent;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct TestMetadata;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct TestCommand;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub struct TestId<'a>(pub &'a str);
impl Aggregate for TestAggregate {
fn aggregate_type() -> &'static str {
"test"
}
}
impl<'a> AggregateId<TestAggregate> for TestId<'a> {
fn as_str(&self) -> &str {
self.0
}
}
impl AggregateCommand<TestAggregate> for TestCommand {
type Error = Void;
type Event = TestEvent;
type Events = Vec<TestEvent>;
fn execute_on(self, _aggregate: &TestAggregate) -> Result<Self::Events, Self::Error> {
Ok(Vec::new())
}
}
const EVENT_TYPE: &str = "test";
impl Event for TestEvent {
fn event_type(&self) -> &'static str {
EVENT_TYPE
}
}
impl AggregateEvent<TestAggregate> for TestEvent {
fn apply_to(self, _aggregate: &mut TestAggregate) {}
}