sourcery_core/lib.rs
1//! Core traits and types for the Sourcery event-sourcing library.
2//!
3//! This crate provides the foundational abstractions for event sourcing:
4//!
5//! - [`aggregate`] - Command-side primitives (`Aggregate`, `Apply`, `Handle`)
6//! - [`projection`] - Read-side primitives (`Projection`, `ProjectionFilters`,
7//! `ApplyProjection`, `Filters`)
8//! - [`repository`] - Command execution and aggregate lifecycle (`Repository`)
9//! - [`store`] - Event persistence abstraction (`EventStore`)
10//! - [`snapshot`] - Snapshot storage abstraction (`SnapshotStore`)
11//! - [`event`] - Event marker traits (`DomainEvent`, `EventKind`,
12//! `ProjectionEvent`)
13//! - [`concurrency`] - Concurrency strategy markers (`Optimistic`, `Unchecked`)
14//!
15//! # Example
16//!
17//! ```
18//! use sourcery_core::{repository::Repository, store::inmemory};
19//!
20//! // Create an in-memory store and repository
21//! let store: inmemory::Store<String, ()> = inmemory::Store::new();
22//! let repo = Repository::new(store);
23//! ```
24//!
25//! Most users should depend on the [`sourcery`](https://docs.rs/sourcery) crate,
26//! which re-exports these types with a cleaner API surface.
27
28pub mod aggregate;
29pub mod concurrency;
30pub mod event;
31pub mod projection;
32pub mod repository;
33pub mod snapshot;
34pub mod store;
35pub mod subscription;
36
37// Test utilities module: public when feature enabled, internal for crate tests
38#[cfg(feature = "test-util")]
39pub mod test;
40
41#[cfg(all(test, not(feature = "test-util")))]
42pub(crate) mod test;