postgres_es2/framework/
postgres_cqrs.rs1use postgres::Client;
2
3use cqrs_es2::{
4 Aggregate,
5 CqrsFramework,
6 QueryProcessor,
7};
8
9use crate::stores::{
10 PostgresStore,
11 PostgresStoreAggregateContext,
12};
13
14pub type PostgresCqrs<A> = CqrsFramework<
18 A,
19 PostgresStore<A>,
20 PostgresStoreAggregateContext<A>,
21>;
22
23pub fn postgres_cqrs<A>(
25 conn: Client,
26 query_processor: Vec<Box<dyn QueryProcessor<A>>>,
27) -> PostgresCqrs<A>
28where
29 A: Aggregate, {
30 let store = PostgresStore::new(conn);
31 CqrsFramework::new(store, query_processor)
32}