View Source AshStateMachine (ash_state_machine v0.2.6)

Provides tools for defining and working with resource-backed state machines.

Summary

Functions

A reusable helper which returns all possible next states for a record (regardless of action).

A reusable helper which returns all possible next states for a record given a specific action.

A utility to transition the state of a changeset, honoring the rules of the resource.

Functions

possible_next_states(record)

@spec possible_next_states(Ash.Resource.record()) :: [atom()]

A reusable helper which returns all possible next states for a record (regardless of action).

possible_next_states(record, action_name)

@spec possible_next_states(Ash.Resource.record(), atom()) :: [atom()]

A reusable helper which returns all possible next states for a record given a specific action.

state_machine(body)

(macro)

Hello!

transition_state(changeset, target)

A utility to transition the state of a changeset, honoring the rules of the resource.