View Source Jido.Signal (Jido v1.0.0)
Defines the structure and behavior of a Signal in the Jido system. Implements CloudEvents specification v1.0.2 with Jido-specific extensions.
Summary
Types
@type t() :: %Jido.Signal{ data: term() | nil, datacontenttype: String.t() | nil, dataschema: String.t() | nil, id: String.t(), jidoaction: [{atom(), map()}] | nil, jidoopts: map() | nil, source: String.t(), specversion: String.t(), subject: String.t() | nil, time: String.t() | nil, type: String.t() }
Functions
Creates a new Signal struct from a map.
Parameters
map
: A map containing the Signal attributes.
Returns
{:ok, Signal.t()}
if the map is valid, {:error, String.t()}
otherwise.
Examples
iex> Jido.Signal.from_map(%{"type" => "example.event", "source" => "/example", "id" => "123"})
{:ok, %Jido.Signal{type: "example.event", source: "/example", id: "123", ...}}
Creates a new Signal struct.
Parameters
attrs
: A map containing the Signal attributes.
Returns
{:ok, Signal.t()}
if the attributes are valid, {:error, String.t()}
otherwise.
Examples
iex> Jido.Signal.new(%{type: "example.event", source: "/example", id: "123"})
{:ok, %Jido.Signal{type: "example.event", source: "/example", id: "123", ...}}