Anoma.Node.Event.DefEvent (Anoma v0.29.0)
I contain the defevent
macro, which facilitates the definition of typed
event structs and optionally associated filters. Require or use me to use defevent
.
Summary
Functions
I am the defevent
macro. I define a typed struct for an event and, if specified,
an associated filter.
Functions
I am the defevent
macro. I define a typed struct for an event and, if specified,
an associated filter.
Parameters
event_module
- The name of the event module.opts
- Keyword options to configure the struct and filter
Options
* `:enforce` - When set to true (default), fields in the struct are enforced.
* `:filter` - The name of the filter module to be created, if desired. If
`nil`, no filter is created.
Example
defevent CompleteEvent, filter: CompleteFilter do
field(:tx_id, integer())
field(:tx_result, {:ok, any()} | :error)
end
defevent CompleteEvent, enforce: true, filter: CompleteFilter do
field(:tx_id, integer())
field(:tx_result, {:ok, any()} | :error)
end