Implements the Ecto.Type behaviour for a user-defined Postgres composite
type called :cldr_unit.
This is the preferred option for Postgres databases since the serialized unit value is stored as a decimal number.
A value is stored in the base unit of its dimension, as
Localize.Unit.BaseUnit.base_unit/1 names it: 2 kilometer is
stored, and loads, as 2000 meter, and 100 celsius as
373.15 kelvin. A comparison or an index on the stored value then
needs no unit conversion, and since only units of one dimension share a
base unit, values of different dimensions still cannot be mixed. A cast
value keeps the unit it was given until it is dumped, and equals its
base unit form, so a changeset records no change between them.
Summary
Functions
Callback implementation for Ecto.Type.cast/1.
Callback implementation for Ecto.Type.dump/1.
Callback implementation for Ecto.Type.embed_as/1.
Callback implementation for Ecto.Type.equal?/2.
Callback implementation for Ecto.Type.load/1.
Callback implementation for Ecto.Type.type/0.
Functions
Callback implementation for Ecto.Type.cast/1.
Callback implementation for Ecto.Type.dump/1.
Callback implementation for Ecto.Type.embed_as/1.
Callback implementation for Ecto.Type.equal?/2.
Callback implementation for Ecto.Type.load/1.
Callback implementation for Ecto.Type.type/0.