Fact.Seam.EventSchema behaviour (Fact v0.2.0)

View Source

Behaviour defining how to retrieve the event schema for a Fact database.

Implementations of this seam provide the mapping between logical event attributes and the string keys under which they are stored in the underlying event map.

The schema returned must conform to Fact.event_record_schema/0, which defines the required keys for an event:

  • :event_data
  • :event_id
  • :event_metadata
  • :event_tags
  • :event_type
  • :event_store_position
  • :event_store_timestamp
  • :event_stream_id
  • :event_stream_position

Callback

  • get/2 – Returns the event schema for a given seam instance and optional parameters.

Summary

Types

t()

@type t() :: struct()

Callbacks

default_options()

@callback default_options() :: map()

family()

@callback family() :: atom()

get(t, opts)

@callback get(t(), opts :: keyword()) :: Fact.event_record_schema()

id()

@callback id() :: {atom(), non_neg_integer()}

init(map)

@callback init(map()) :: struct() | {:error, term()}

normalize_options(map)

@callback normalize_options(map()) :: {:ok, map()} | {:error, term()}

option_specs()

@callback option_specs() :: %{required(atom()) => map()}

prepare_options(map)

@callback prepare_options(map()) :: map()

version()

@callback version() :: non_neg_integer()