commanded-ecto-projections
commanded-ecto-projections copied to clipboard
Read model projections for Commanded using Ecto
Commanded Ecto Projections
Read model projections for Commanded CQRS/ES applications using Ecto for persistence.
Read the Changelog for recent changes and the Hex Docs on API usage.
This README and the following guides follow the
masterbranch which may not be the currently published version.
Overview
- Getting started
- Usage
- Creating a read model
- Creating a projector
- Supervision
- Error handling
error/3callback- Error handling example
after_update/3callback- Schema prefix
- Rebuilding a projection
Example projector
defmodule MyApp.ExampleProjector do
use Commanded.Projections.Ecto,
application: MyApp.Application,
repo: MyApp.Projections.Repo,
name: "MyApp.ExampleProjector"
project %AnEvent{} = event, _metadata, fn multi ->
%AnEvent{name: name} = event
projection = %ExampleProjection{name: name}
Ecto.Multi.insert(multi, :example_projection, projection)
end
end
Contributing
Pull requests to contribute new or improved features, and extend documentation are most welcome. Please follow the existing coding conventions.
You should include unit tests to cover any changes. Run mix test to execute the test suite:
mix deps.get
MIX_ENV=test mix setup
mix test
Contributors
Need help?
Please open an issue if you encounter a problem, or need assistance. You can also seek help in the Gitter chat room for Commanded.
For commercial support, and consultancy, please contact Ben Smith.
Copyright and License
Copyright (c) 2017 Ben Smith
This library is released under the MIT License. See the LICENSE.md file for further details.