Expand description
§MiniCQRS/ES
MiniCQRS/ES is a Rust library that simplifies the implementation of the Command-Query Responsibility Segregation (CQRS) architectural pattern in your application.
§Key Features
- Provides traits for defining aggregates, commands, and event consumers.
- Manages aggregates’ state and events handling with optimistic concurrency.
- Supports event stores and snapshot stores.
- Supports queries on read models.
- All trait methods take
&selffor easy concurrent usage. - No
async_traitdependency — uses native async fn in traits.
For more detailed documentation, refer to the specific modules and types provided by MiniCQRS/ES.
Re-exports§
pub use ::anyhow;
Structs§
- Aggregate
Snapshot - The
AggregateSnapshotstruct represents a snapshot of an aggregate’s state at a specific version. - Event
Consumers - A collection of event consumers that processes events through all of them.
- Event
Metadata - Optional metadata associated with an event.
- NewEvent
- A new event to be persisted by the event store.
- Simple
Aggregate Manager - A simple implementation of the
AggregateManagertrait. It loads aggregates by replaying their events from the associatedEventStore, but doesn’t implement any storage logic. - Simple
Cqrs - A synchronous-consumer implementation of the
Cqrstrait. - Snapshot
Aggregate Manager - An aggregate manager that uses a snapshot store to load and store aggregates.
- Stored
Event - A persisted event envelope.
Enums§
- Cqrs
Error - An error that can occur in a CQRS application.
Traits§
- Aggregate
- The
Aggregatetrait defines the behavior of an aggregate, which represents the state of a domain entity and can be modified by applying events. - Aggregate
Manager - The
AggregateManagertrait defines the behavior for loading and storing the state of aggregates. - Command
- The
Commandtrait defines the behavior of a command in a CQRS application. - Cqrs
- The
Cqrstrait represents the main entry point of a CQRS application. - Event
Consumer - The
EventConsumertrait defines the behavior of an event consumer, which is responsible for processing events (e.g., updating read models, sending notifications). - Event
Payload - The
EventPayloadtrait defines the behavior of an event payload, representing the change the event made to the state of an aggregate. - Event
Store - The
EventStoretrait defines the behavior for storing and loading events, allowing the application to keep a historical record of state changes. - Query
- The
Querytrait represents a query that allows to retrieve information from read models. - Query
Runner - The
QueryRunnertrait can be implemented to provide aquerymethod on your types. - Repository
- A marker trait for repository types used in read model projections.
- Snapshot
Store - The
SnapshotStoretrait defines the behavior for storing and loading aggregate snapshots.