mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
33 lines
690 B
Elixir
33 lines
690 B
Elixir
defmodule Status do
|
|
@moduledoc false
|
|
|
|
use Ash.Type.Enum, values: [:open, :Closed, :NeverHappened, :Always_Was]
|
|
|
|
def match("never_happened"), do: {:ok, :NeverHappened}
|
|
def match(value), do: super(value)
|
|
end
|
|
|
|
defmodule DescriptiveEnum do
|
|
@moduledoc false
|
|
|
|
use Ash.Type.Enum,
|
|
values: [
|
|
{:foo, "Clearly a foo"},
|
|
{:bar, "Obviously a bar"},
|
|
{:baz, "Undoubtedly a baz"},
|
|
:a_thing_with_no_description,
|
|
{:another_thing_with_no_description, nil}
|
|
]
|
|
end
|
|
|
|
defmodule StringEnum do
|
|
@moduledoc false
|
|
|
|
use Ash.Type.Enum, values: ["foo", "bar", "baz"]
|
|
end
|
|
|
|
defmodule MixedEnum do
|
|
@moduledoc false
|
|
|
|
use Ash.Type.Enum, values: [:foo, "bar", "baz"]
|
|
end
|