A deserialized event together with its store metadata.
Projections and commands receive Envelope structs when reading events.
Pattern-match on the data field to handle specific event types:
def apply(state, %Counterpoint.Envelope{data: %MyApp.Events.OrderPlaced{order_id: id}}) do
Map.put(state, :order_id, id)
endFields
type– the event's type string (e.g."OrderPlaced").tags– tags stored alongside the event.data– the deserialized event struct.position– opaque store position used for optimistic-concurrency conditions.occurred_at– parsed from the event map's"occurred_at"key, if present.
Summary
Types
@type t() :: %Counterpoint.Envelope{ data: struct(), occurred_at: DateTime.t() | nil, position: binary(), tags: [String.t()], type: String.t() }