Skip to content

synchronal/ecto_email

Repository files navigation

EctoEmail

CI Hex pm

An Ecto.Type for email addresses, using the ex_email library for validations. When using a database column type interchangeable with :string such as :text, :string, or :citext, this type may be used in the schema module to provide automatic validation of inputs.

Our open source Ecto.Type libraries:

This library is tested against the most recent 3 versions of Elixir and Erlang.

Sponsorship 💕

This library is part of the Synchronal suite of libraries and tools which includes more than 15 open source Elixir libraries as well as some Rust libraries and tools.

You can support our open source work by sponsoring us. If you have specific features in mind, bugs you'd like fixed, or new libraries you'd like to see, file an issue or contact us at [email protected].

Installation

def deps do
  [
    {:ecto_email, "~> 1.0"}
  ]
end
defmodule Schema.Person do
  use Ecto.Schema
  import Ecto.Changeset

  schema "people" do
    field :email_address, EctoEmail
  end

  def changeset(data \\ %__MODULE__{}, attrs) do
    data
    |> cast(Map.new(attrs), ~w[email_address]a)
  end
end

See the documentation for more info.

Development

This project uses medic for its development workflow.

brew bundle

bin/dev/doctor
bin/dev/test
bin/dev/audit
bin/dev/update
bin/dev/shipit

Please take a look at .config/medic.toml for the checks that must pass in order for changes to be accepted.