OnePiece.Commanded.Aggregate behaviour (OnePiece.Commanded v0.2.1) View Source
Defines the an OnePiece.Commanded.Aggregate
behaviour.
Link to this section Summary
Callbacks
Apply a given event to the aggregate returning the new aggregate state.
Functions
Convert the module into a Aggregate
behaviour.
Link to this section Types
Link to this section Callbacks
Link to this section Functions
Specs
__using__(opts :: []) :: any()
Convert the module into a Aggregate
behaviour.
Usage
defmodule Account do
use OnePiece.Commanded.Aggregate
@impl OnePiece.Commanded.Aggregate
def apply(account, event) do
account
|> Map.put(:name, event.name)
|> Map.put(:description, event.description)
end
end