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
master
branch which may not be the currently published version.
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
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
Please open an issue if you encounter a problem, or need assistance. You can also seek help in the #commanded channel in the official Elixir Slack.
Copyright (c) 2017 Ben Smith
This library is released under the MIT License. See the LICENSE.md file for further details.