Closed aitoroses closed 1 year ago
Hi @aitoroses,
I think deriving Clone
here would be fine, I'll verify this and get it included with the next version.
In the meantime you can use MemStore::get_events(&self)
to access to the underlying event map. Example:
let event_store = MemStore::<MyAggregate>::default();
let stored_events = event_store.get_events();
let cqrs = CqrsFramework::new(event_store, vec![], MyService);
cqrs.execute("test_id", MyCommands::DoSomething).await.unwrap();
let unlocked_event_map = stored_events.read().unwrap();
assert_eq!(unlocked_event_map.get("test_id").unwrap().len(), 1);
Hi there!
When I try to test an aggregate by using a
MemStore
and then trying to load the resulting aggregate I'm having this error:I tried to copy the source of MemStore and use
derive(Clone)
, then I can just clone theevent_store
and it works without any problem.Is this intentional? or is there another better way to handle this use case?
Thanks!