Rdux
Minimal take on event sourcing.
Usage
$ bin/rails rdux:install:migrations
$ bin/rails db:migrate
Code structure
Dispatch action
Rdux.perform(
Activity::Stop,
{ activity_id: current_activity.id },
{ activity: current_activity },
meta: {
stream: { user_id: 123, context: 'foo' }, bar: 'baz'
}
)
Return
Rdux::Result[true, { activity: activity }]
Installation
Add this line to your application's Gemfile:
gem 'rdux'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rdux
Test
Setup
$ cd test/dummy
$ DB=all bin/rails db:create
$ DB=all bin/rails db:prepare
$ cd ../..
Run tests
$ DB=postgres bin/rails test
$ DB=sqlite bin/rails test
License
The gem is available as open source under the terms of the MIT License.