Fact.Seam.EventSchema.Emmett.V1 (Fact v0.3.1)

View Source

An EventSchema similar to the schema used in the Emmett NodeJs library.

See the definition on GitHub

Differences

Emmetts event records do not support a field for event tags. By default __tags__ is used, but this may be configured when the database is created.

$ mix fact.create --path tmp/emmett-ish \
    --event-schema emmett@1 \
    --event-schema-options event_tags=tags

Additionally, Emmett supports a kind field, which Fact does not support at this time.

Example

When using emmett@1, persisted event records will take the following shape, with the caveat that __tags__ may differ if configured to something else.

{
  "data": {name: "Turts"},
  "messageId": "3bb4808303c847fd9ceb0a1251ef95da",
  "metadata": {"correlationId": "240d3c0e-3251-4076-a769-97a6a705533e"},
  "__tags__": ["turtle:1"],
  "type": "egg_hatched",
  "globalPosition": "2",
  "created": 1765039106962264,
  "streamName": "turtle-1",
  "streamPosition": 1,
}

Summary

Types

t()

Configuration options for the Emmett event schema.

Functions

Gets the default options.

Gets a map of the keys used for Emmett-like event records.

Gets the specification for the configuration options.

Types

t()

(since 0.2.0)
@type t() :: %Fact.Seam.EventSchema.Emmett.V1{event_tags: String.t()}

Configuration options for the Emmett event schema.

Functions

default_options()

(since 0.2.0)
@spec default_options() :: t()

Gets the default options.

get(v1, opts)

(since 0.2.0)
@spec get(
  t(),
  keyword()
) :: Fact.event_record_schema()

Gets a map of the keys used for Emmett-like event records.

option_specs()

(since 0.2.0)

Gets the specification for the configuration options.

validate_options(options, specs)

(since 0.2.0)