MscmpSystDb.DbTypes.Interval (mscmp_syst_db v0.1.0)

An Elixir representation of the PostgreSQL interval data type.

Derived from the Postgrex.Interval data type. For more information about this data type, see: The PostgreSQL Documentation: Date/Time Types

Summary

Functions

Callback implementation for Ecto.Type.embed_as/1.

Callback implementation for Ecto.Type.equal?/2.

Converts an Interval into a form that can be used by the Timex library's Timex.shift/2 function.

Types

@type t() :: %MscmpSystDb.DbTypes.Interval{
  days: integer(),
  microsecs: integer(),
  months: integer(),
  secs: integer()
}

Functions

Callback implementation for Ecto.Type.embed_as/1.

Link to this function

equal?(term1, term2)

Callback implementation for Ecto.Type.equal?/2.

Link to this function

to_timex_shift_options(interval)

@spec to_timex_shift_options(t()) :: MscmpSystDb.Types.timex_shift_options()

Converts an Interval into a form that can be used by the Timex library's Timex.shift/2 function.

Example

iex> example_interval =
...>   %MscmpSystDb.DbTypes.Interval{months: 1, days: 1, secs: 1, microsecs: 1}
iex> MscmpSystDb.DbTypes.Interval.to_timex_shift_options(example_interval)
[months: 1, days: 1, seconds: 1, microseconds: 1]