UmaDbClient.Event
(uma_db_client v0.6.14)
Copy Markdown
A recorded event in a plain Elixir shape.
This is what the facade generated by use UmaDbClient returns from read/2
and subscribe/2, in place of the generated UmaDb.V1.SequencedEvent struct:
dataholds the decoded payload when a:decodefunction is configured, or the raw binary when it is not. An event recorded without a payload comes back asnilrather than"".metadatais a plain map instead of a list ofUmaDb.V1.MetadataEntrystructs.uuidisnilwhen the event carries no identifier, rather than"".
UmaDbClient.read/2 and UmaDbClient.subscribe/2 are unaffected — they
continue to return UmaDb.V1.SequencedEvent structs.
Summary
Functions
Converts an UmaDb.V1.SequencedEvent into an UmaDbClient.Event.
Types
Functions
@spec from_sequenced(UmaDb.V1.SequencedEvent.t(), term()) :: t()
Converts an UmaDb.V1.SequencedEvent into an UmaDbClient.Event.
decode is a one-argument function, a {module, function} tuple, a module
exporting decode!/1, or nil to leave data as raw bytes.
An empty payload is never passed to decode — it becomes nil. Decoders such
as Jason.decode!/1 raise on an empty string, so this keeps events recorded
without a payload readable.