Implements the Ecto.Type behaviour for a user-defined Postgres composite
type called :cldr_unit_with_usage.
This is the preferred option for Postgres databases since the serialized unit value is stored as a decimal number and the unit usage is preserved across the round trip.
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.
The usage is kept, so an application can show a loaded value in the unit a locale prefers for that usage.
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.