postgres_es2/stores/postgres_store_aggregate_context.rs
1use cqrs_es2::{
2 Aggregate,
3 AggregateContext,
4};
5
6/// Holds context for a pure event store implementation for MemStore
7pub struct PostgresStoreAggregateContext<A: Aggregate> {
8 /// The aggregate ID of the aggregate instance that has been
9 /// loaded.
10 pub aggregate_id: String,
11 /// The current state of the aggregate instance.
12 pub aggregate: A,
13 /// The last committed event sequence number for this aggregate
14 /// instance.
15 pub current_sequence: usize,
16}
17
18impl<A: Aggregate> AggregateContext<A>
19 for PostgresStoreAggregateContext<A>
20{
21 fn aggregate(&self) -> &A {
22 &self.aggregate
23 }
24}