Skip to content

ssbb/absinthe_ecto_enum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages