esrs 0.9.0

A Prima.it-opinionated library to achieve cqrs/es
Documentation

Event sourcing.rs

It is an opinionated library used to achieve cqrs/es in Rust.

A set of example snippets can be found in the example folder.

Install

Event Sourcing RS uses under the hood sqlx.

# Cargo.toml
[dependencies]
# postgres database
esrs = { version = "0.6", features = ["postgres"] }
sqlx = { version = "0.6", features = ["postgres", "runtime-tokio-native-tls", "uuid", "json", "chrono"] }

Tracing

A tracing span is produced every time a projector is used or a policy is applied to a given event.

Run examples, tests and linting

Start a Postgres instance.

docker run -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=postgres -d postgres:11-alpine

Export DATABASE_URL environment variable with freshly new created database.

export DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres

Run tests.

cargo test --all-targets --all-features

Run linters.

cargo clippy --all-targets --all-features -- -W clippy::nursery

Finally eventually unset DATABASE_URL environment variable.

unset DATABASE_URL