ecto_fields v1.1.5 EctoFields.Atom

Coerce a regular string into an atom

Examples

Note: only use this field when you have a fixed number of possible values (atoms are not garbage collected)

iex> EctoFields.Atom.cast("started")
{:ok, :started}

iex> EctoFields.Atom.cast(:started)
{:ok, :started}

iex> EctoFields.Atom.cast(nil)
{:ok, nil}