Skip to content

sezaru/ecto_atom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ecto.Atom

Provide an Ecto custom type Ecto.Atom to manage :atom.

Installation

If available in Hex, the package can be installed by adding ecto_atom to your list of dependencies in mix.exs:

def deps do
  [{:ecto_atom, github: "sezaru/ecto_atom", tag: "1.0.2"}]
end

Use

defmodule MyApp.User do
  use MyApp.Web, :model

  @primary_key {:id, :binary_id, autogenerate: true}
  @derive {Phoenix.Param, key: :id}

  schema "users" do
    field :email, :string
    field :provider, Ecto.Atom  # :github => 'github' in DB
    field :uid, :string
    field :token, :string
    ...
  end
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ecto_atom.

About

Ecto atom

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 100.0%