Datumo.Event protocol (datumo v0.1.0)

Copy Markdown View Source

A domain event, declared on its struct:

@derive {Datumo.Event,
         type: "PlotRegistered",
         tags: [:plot_id, :owner_id, region: [:address, "regionId"]]}
defstruct [:plot_id, :owner_id, :address, :registered_at]
  • type is the event's title on the board, verbatim. It is what the store keeps and what other slices match on, so it never comes from the module name: renaming a module must not rename a fact.
  • tags are the board's fields with idAttribute: true or tag: true. :plot_id gives "plot:<value>". A subfield goes by its path: region: [:address, "regionId"] gives "region:<value>". Through a list, one tag per element: lot: [:lots, :lot_id]. A nil value gives no tag.

to_event/1 returns %{type:, data:, tags:}, the shape FACT and UmaDB both store.

Summary

Types

t()

All the types that implement this protocol.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

to_event(event)