Interval type for Ecto, currently only implemented for PostgreSQL, PR's to support others are welcome.
If available in Hex, the package can be installed
by adding ecto_interval
to your list of dependencies in mix.exs
:
def deps do
[{:ecto_interval, "~> 0.1.0"}]
end
Just use EctoInterval
as a field type, like:
field :renewal_period, EctoInterval, default: %{months: 0, days: 0, secs: 0}
- Special thanks to @ibarchenkov for updating to latest implementation!