Provides commonly used fields for Ecto projects.
To install EctoFields:
- Add ecto_fields to your list of dependencies in
mix.exs
:
def deps do
[{:ecto_fields, "~> 1.3.0"}]
end
- Use the fields in your Ecto schema:
schema "user" do
field :name, :string
field :email, EctoFields.Email
field :website, EctoFields.URL
field :ip_address, EctoFields.IP
end
- EctoFields.Atom
- EctoFields.Email
- EctoFields.IP (accepts both ipv4 and ipv6)
- EctoFields.IPv4
- EctoFields.IPv6
- EctoFields.PositiveInteger
- EctoFields.Slug
- EctoFields.Static
- EctoFields.URL
- EctoFields.Duration
- EctoFields.File
- EctoFields.Image