fsmx v0.1.1 Fsmx.Fsm behaviour View Source
Holds transition and callback logic for finite state machines
By default, when using use Fsmx.Struct
, this is automatically included as well.
Specifying use Fsmx.Struct, fsm: MyApp.Fsm
allows you to decouple this, though
defmodule MyApp.Struct do
defstruct [:state]
end
defmodule MyApp.Fsm do
use Fsmx.Fsm, transitions: %{}
def before_transition(struct, _from, _to) do
# ...
end
end
Link to this section Summary
Link to this section Callbacks
Specs
Specs
Specs
transition_changeset(struct(), binary(), binary()) :: {:ok, Ecto.Changeset.t()} | {:error, any()}