Absinthe.EctoEnum
Provides some helper fucnions for EctoEnum integration with Absinthe.
This functions make it easy to integrate enums defined with EctoEnum with GraphQL API build with Absinthe.
Installation
Add absinthe_ecto_enum
to mix.exs
:
def deps do
[{:absinthe_ecto_enum, "~> 0.1.0"}]
end
Basic Usage
import EctoEnum
defenum StatusEnum, :status, [:active, :pending, :failed]
defmodule MyApp.Web.Schema.Enums do
use Absinthe.EctoEnum
ecto_enum StatusEnum
end
ecto_enum
macro will produce this code:
enum :status do
value :active
value :pending
value :failed
end