Maxine.Workflow behaviour (Maxine v1.1.1)

A behaviour that specifies a machine and a set of filters to transform and/or validate a changeset. The machine is a %Maxine.Machine{} and the filters are given in two functions, events/0 and states/0 that return maps keyed by event name, and whose values are modules implementing the are a module or function to be passed as the validate_with option to cast_state/3. See cast_workflow/3 and cast_state/3 for more information.

Link to this section Summary

Functions

Uses cast_state/3 to provide a convenient usage pattern.

Link to this section Types

Link to this type

event_name()

Specs

event_name() :: :atom
Link to this type

filter_module()

Specs

filter_module() :: :atom
Link to this type

machine_tuple()

Specs

machine_tuple() :: {:atom, :atom, :atom}
Link to this type

state_name()

Specs

state_name() :: :atom

Link to this section Functions

Link to this function

cast_workflow(changeset, workflow, options \\ [])

Uses cast_state/3 to provide a convenient usage pattern.

Link to this section Callbacks

Specs

events() :: %{} | %{required(event_name()) => filter_module()}

Specs

machine() :: %Maxine.Machine{
  callbacks: term(),
  groups: term(),
  initial: term(),
  transitions: term()
}

Specs

states() :: %{} | %{required(state_name()) => filter_module()}