ecto_fields v1.3.0 EctoFields.Email
Link to this section Summary
Functions
Validate that the given value is a valid email
Callback implementation for Ecto.Type.dump/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.load/1
.
Callback implementation for Ecto.Type.type/0
.
Link to this section Functions
Link to this function
cast(email)
Validate that the given value is a valid email
Examples
iex> EctoFields.Email.cast("foo.bar@example.com ")
{:ok, "foo.bar@example.com"}
iex> EctoFields.Email.cast("foo.bar+baz/@long.example.photography.uk")
{:ok, "foo.bar+baz/@long.example.photography.uk"}
iex> EctoFields.Email.cast("test@localhost")
{:ok, "test@localhost"}
iex> EctoFields.Email.cast("test@192.168.10.1")
{:ok, "test@192.168.10.1"}
iex> EctoFields.Email.cast("test@2001:1620:28:1:b6f:8bca:93:a116")
{:ok, "test@2001:1620:28:1:b6f:8bca:93:a116"}
iex> EctoFields.Email.cast("foo.bar@example.com/")
:error
iex> EctoFields.Email.cast("foo.bar@example.com.")
:error
iex> EctoFields.Email.cast("bad email")
:error
iex> EctoFields.Email.cast("test@example.com<script src='x.js'>")
:error
Link to this function
dump(email)
Callback implementation for Ecto.Type.dump/1
.
Link to this function
embed_as(_)
Link to this function
equal?(a, b)
Callback implementation for Ecto.Type.equal?/2
.
Link to this function
load(email)
Callback implementation for Ecto.Type.load/1
.
Link to this function
type()
Callback implementation for Ecto.Type.type/0
.