View Source Command (reactive_commons v1.0.2)

Commands represent a intention for doing something, that intention must to be done by the domain context with that responsibility. An example of a command may be: "RegisterUser" or "SendNotification".

Summary

Functions

Creates a new Command structure with a generated command_id

Creates a new Command structure

Functions

Creates a new Command structure with a generated command_id

Examples

iex> Command.new("RegisterUser", %{name: "username", email: "user@example.com"})
%Command{
  commandId: "a313623c-4701-40d3-95e0-bde25e02b52a",
  data: %{email: "user@example.com", name: "username"},
  name: "registerUser"
}
Link to this function

new(name, data, command_id)

View Source

Creates a new Command structure

Examples

iex> Command.new("RegisterUser", %{name: "username", email: "user@example.com"}, "4016ab59-16d0-41cd-ba4f-52ce200f8ea8")
%Command{
  commandId: "4016ab59-16d0-41cd-ba4f-52ce200f8ea8",
  data: %{email: "user@example.com", name: "username"},
  name: "registerUser"
}