ExEventBus.Event (ExEventBus v0.3.0)

View Source

Defines macros to define events

Summary

Functions

Returns true if term is an ExEventBus.Event; otherwise returns false. Allowed in guard tests.

Returns true if term is an ExEventBus.Event of name; otherwise returns false. Allowed in guard tests.

Types

t()

@type t() :: %{
  __struct__: module(),
  __event_bus_event__: true,
  aggregate: map() | nil,
  changes: map() | nil,
  metadata: map() | nil
}

Functions

build_event(event, data, changes, metadata)

build_events(event, record, changes, metadata, acc \\ [])

defevent(name)

(macro)

defevents(names)

(macro)

is_event(term)

(macro)

Returns true if term is an ExEventBus.Event; otherwise returns false. Allowed in guard tests.

Examples

iex> is_event(%MyEvent{})
true
iex> is_event(%{})
false

is_event(term, name)

(macro)

Returns true if term is an ExEventBus.Event of name; otherwise returns false. Allowed in guard tests.

Examples

iex> is_event(%MyEvent{}, MyEvent)
true
iex> is_event(%MyEvent{}, Macro.Env)
false