Packages

Provides DSL and functions for defining and handling `Ecto.Schema` based FSM

Current section

Files

Jump to
ecto_fsm lib ecto fsm helpers.ex
Raw

lib/ecto/fsm/helpers.ex

defmodule Ecto.FSM.Helpers do
@moduledoc """
Utilities functions imported into module using `Ecto.FSM`
"""
@doc """
Generates `state` field for FSM
"""
defmacro state(opts \\ []) do
field = Keyword.get(opts, :field, :state)
type = :string
quote do
Ecto.Schema.field(unquote(field), unquote(type))
end
end
end