View Source Gearbox.Ecto (Gearbox v0.3.4)
Ecto support module for Gearbox.
This allows creation of Ecto changeset based on the result of the transition.
Link to this section Summary
Functions
Creates a changeset based on the transition outcome of an Ecto struct.
Link to this section Functions
@spec transition_changeset( struct :: struct(), machine :: any(), next_state :: Gearbox.state() ) :: {:ok, struct() | map()} | {:error, Ecto.Changeset.t()}
Creates a changeset based on the transition outcome of an Ecto struct.
Returns a tuple containing a changeset:
{:ok, changeset}
with the transitioned field if the transition can be made{:error, error_changeset}
with an error populated if transition cannot be made.