massex v0.1.0 Massex.Ecto.Type View Source
Provides a type for Ecto to store masses with their units. The underlying type should be a map, JSONB would be perfect in a PostgreSQL database.
Migration Example
create table(:foo) do
add :mass, :jsonb
end
Schema Example
schema "foo" do
field :mass, Massex.Ecto.Type
end
Link to this section 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
.
Link to this section Functions
Specs
Callback implementation for Ecto.Type.cast/1
.
Specs
Callback implementation for Ecto.Type.dump/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Specs
Callback implementation for Ecto.Type.load/1
.
Specs
type() :: :map
Callback implementation for Ecto.Type.type/0
.