DDD.DomainEvent behaviour (vicander v0.1.1)

Copy Markdown View Source

Behaviour and macros for Domain Events.

Domain Events represent meaningful things that happened in the domain. Named in past tense, they carry all data needed to understand the occurrence.

Usage

defmodule MyApp.Events.OrderPlaced do
  use DDD.DomainEvent

  domain_event do
    field :order_id,    :string
    field :customer_id, :string
  end
end

event = MyApp.Events.OrderPlaced.new(%{order_id: "123", customer_id: "c1"})

Summary

Callbacks

event_name()

@callback event_name() :: String.t()

Functions

domain_event(list)

(macro)

field(name, type, opts \\ [])

(macro)