mix pd.gen.projection (PropertyDamage v0.2.0)

View Source

Generate a PropertyDamage projection module.

Projections track state and optionally define assertions using @trigger or @poll_state attributes.

Usage

mix pd.gen.projection MyApp.Projections.ModelState

Examples

mix pd.gen.projection MyApp.Projections.ModelState
mix pd.gen.projection MyApp.Projections.BalanceInvariant

Generated Template

The generated projection includes:

  • init/0 - Initialize projection state
  • apply/2 - Apply commands/events to state (with example)
  • @trigger assertion example (synchronous)
  • @poll_state assertion example (temporal/eventual consistency)

More Information

See PropertyDamage.Model.Projection for full documentation on:

  • State tracking with apply/2
  • Synchronous assertions with @trigger
  • Temporal assertions with @poll_state