View Source Backstage.Aggregate protocol (backstage v0.0.2)
An entity used to enforce business rules and ensure consistent state.
When implementing an Aggregate
, consider what rules are important to the business for the given entity. For example, this is where you may enforce email uniqueness or age restrictions for users if it is important to your business.
Summary
Functions
Validates the incoming command meets business requirements, if any.
Modifies Aggregate
state based on some or all data from the event.
Types
Functions
@spec handle_command(command :: Backstage.Command.t(), state :: term()) :: event() | {:error, term()}
Validates the incoming command meets business requirements, if any.
Returns an event struct or an error tuple.
Modifies Aggregate
state based on some or all data from the event.
Returns an updated aggregate struct.