Fact.Seam.EventSchema.Marten.V1 (Fact v0.3.1)
View SourceAn EventSchema similar to the schema used in the MartenDB .NET client.
See the Marten documentation
Differences
MartenDB event records do not support a field for metadata or event tags.
By default __metadata__ and __tags__ are used, but this may be configured
when the database is created.
$ mix fact.create --path tmp/marten-ish \
--event-schema marten@1 \
--event-schema-options event_metadata=metadata,event_tags=tags
Additionally, Marten supports tenant_id and mt_dotnet_type fields, which Fact does not support at this time.
Example
When using marten@1, persisted event records will take the following shape, with the caveat that
__metadata__ and __tags__ may differ if configured to something else.
{
"data": {name: "Turts"},
"id": "3bb4808303c847fd9ceb0a1251ef95da",
"__metadata__": {"correlationId": "240d3c0e-3251-4076-a769-97a6a705533e"},
"__tags__": ["turtle:1"],
"type": "egg_hatched",
"seq_id": "2",
"timestamp": 1765039106962264,
"stream_id": "turtle-1",
"version": 1,
}
Summary
Functions
Gets the default options.
Gets a map of the keys used for MartenDB-like event records.
Gets the specification for the configuration options.
Types
Functions
@spec default_options() :: t()
Gets the default options.
@spec get( t(), keyword() ) :: Fact.event_record_schema()
Gets a map of the keys used for MartenDB-like event records.
Gets the specification for the configuration options.