View Source Backpex.Ecto.Amount.Type (Backpex v0.6.0)

Provides a type for Ecto to store a amount. The underlying data type should be an integer.

Migration

create table(:my_table) do
  add :amount, :integer
end

Schema

schema "my_table" do
  field :amount, Backpex.Ecto.Amount.Type
end

schema "my_table" do
  field :amount, Backpex.Ecto.Amount.Type, currency: :EUR, separator: ".", delimiter: ","
end

Summary

Functions

Callback implementation for Ecto.ParameterizedType.cast/2.

Callback implementation for Ecto.ParameterizedType.dump/3.

Callback implementation for Ecto.ParameterizedType.init/1.

Callback implementation for Ecto.ParameterizedType.load/3.

Callback implementation for Ecto.ParameterizedType.type/1.