1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! # cqrs-postgres
//!
//! `cqrs-postgres` is an implementation of the CQRS system with persistence to a PostgreSQL backend.

#![warn(
    unused_import_braces,
    unused_imports,
    unused_qualifications,
    missing_docs
)]
#![deny(
    missing_debug_implementations,
    missing_copy_implementations,
    trivial_casts,
    trivial_numeric_casts,
    unsafe_code,
    unused_must_use
)]

#[cfg(test)]
extern crate cqrs;
#[cfg(test)]
extern crate cqrs_todo_core;
#[cfg(test)]
extern crate static_assertions;

mod db_wrapper;
mod error;
mod reactor;
mod store;
mod util;

pub mod raw;

#[doc(inline)]
pub use crate::error::{LoadError, PersistError};
#[doc(inline)]
pub use crate::store::PostgresStore;

#[cfg(test)]
mod tests {
    use super::*;
    use cqrs_todo_core::{TodoAggregate, TodoEvent, TodoMetadata};
    use static_assertions::assert_impl;

    #[test]
    fn postgres_store_is_an_entity_store() {
        assert_impl!(PostgresStore<TodoAggregate, TodoEvent, TodoMetadata>, cqrs::EntityStore<TodoAggregate, TodoEvent, TodoMetadata>);
    }

    #[test]
    fn postgres_store_is_an_entity_source() {
        assert_impl!(PostgresStore<TodoAggregate, TodoEvent, TodoMetadata>, cqrs::EntitySource<TodoAggregate, TodoEvent>);
    }

    #[test]
    fn postgres_store_is_an_entity_sink() {
        assert_impl!(PostgresStore<TodoAggregate, TodoEvent, TodoMetadata>, cqrs::EntitySink<TodoAggregate, TodoEvent, TodoMetadata>);
    }
}