View Source Memorex.Ecto.TimexDuration (Memorex v0.2.2)

An Ecto type which lets Timex.Duration be stored in Postgres as an integer (representing number of seconds). The Timex.Duration is converted to seconds when it is written to the database, and is converted back to a Timex.Duration when it is read from the database.

To use, simply mark a field as type TimexDuration in the schema file. For example, see field :interval on Memorex.Domain.Card, e.g., field :interval, TimexDuration

See here for more info on creating Ecto types.

Link to this section Summary

Functions

Callback implementation for Ecto.Type.embed_as/1.

Link to this section Functions

Callback implementation for Ecto.Type.embed_as/1.