Skip to content

inosion/esrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event sourcing.rs

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

A complete example can be found in the example folder.

Install

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" ] }

Run examples and tests

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-alpine

Export DATABASE_URL environment variable with freshly new created database.

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

Run 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-features

Then eventually unset database_url variable.

unset DATABASE_URL

About

PrimaIT esrs / eventually-rs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages