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

View Source

Generate a PropertyDamage command module.

Usage

mix pd.gen.command MyApp.Commands.CreateUser

Options

--semantics SEM       Command semantics (sync, probe, async)
--fields FIELDS       Comma-separated field names

Server-generated values

Commands no longer declare the refs they create. Instead, mark server-generated fields with external() in your event struct definitions:

defmodule MyApp.Events.UserCreated do
  import PropertyDamage, only: [external: 0]
  defstruct [:name, :email, id: external()]  # id is server-generated
end

See PropertyDamage.external/0 for full documentation.

Examples

# Basic command
mix pd.gen.command MyApp.Commands.CreateUser

# Probe command with fields
mix pd.gen.command MyApp.Commands.GetUser --semantics probe --fields user_ref

# Command with multiple fields
mix pd.gen.command MyApp.Commands.UpdateUser --fields user_ref,name,email