TeaVent v0.1.0 TeaVent.Event View Source

The data-representation of the occurrence of an event that is forwarded through the TeaVent stack.

Fields:

topic: An identification of the ‘logical context’ the event works on. name: The kind of event that is happening. data: More information that determines what this event is trying to change. subject: This field is filled in by the context_provider (if you have one), based on the topic, to contain a concrete representation of the logical context the event works on. changed_subject: This field is filled in by the result of calling the resolver function. It is how the subject will look like after it has been altered by the event. changes: This is automatically filled in by TeaVent once subject and changed_subject are filled in (and if and only if both of them are maps or structs) to contain a map of changes between the two. This map contains all keys+values that are different in changed_subject from subject.

It is allowed to pattern-match on these fields, but subject, changed_subject and changes will be filled-in automatically by TeaVent. (topic, name, data and meta are allowed to be accessed/altered directly.)

Link to this section Summary

Link to this section Types

Link to this type t() View Source
t() :: %TeaVent.Event{
  changed_subject: any(),
  changes: map(),
  data: term(),
  meta: map(),
  name: binary() | atom(),
  subject: any(),
  topic: any()
}

Link to this section Functions

Link to this function new(topic, name, data \\ %{}, meta \\ %{}) View Source