It is an opinionated library used to achieve cqrs/es in Rust.
A complete example can be found in the example folder.
Event Sourcing RS uses under the hood sqlx.
# Cargo.toml
[dependencies]
# postgres database
esrs = { version = "0.3", features = [ "postgres" ] }
# sqlite database
esrs = { version = "0.3", features = [ "sqlite" ] }Payment examples simulate paying with credit card goods or services updating bank account (so its balance).
To run examples and tests first you need to start new postgres instance. You'll not be able to run postgres example and tests otherwise.
docker run --name postgres -e POSTGRES_PASSWORD=postgres -d postgres:11-alpineExport DATABASE_URL environment variable with freshly new created database.
export DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgresRun both examples, all tests and linting.
cargo run --example postgres-payments && \
cargo run --example sqlite-payments && \
cargo test --all-targets --all-features && \
cargo clippy --all-targets --all-featuresThen eventually unset database_url variable.
unset DATABASE_URL