View Source Money.Ecto.Type (Money v1.12.1)

WARNING: This module is deprecated. Use Money.Ecto.Amount.Type module instead.

Provides a type for Ecto usage. The underlying data type should be an integer.

This type expects you to use a single currency. The currency must be defined in your configuration.

config :money,
  default_currency: :GBP

migration-example

Migration Example

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

schema-example

Schema Example

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

Link to this section Summary

Functions

cast(val) deprecated

Callback implementation for Ecto.Type.cast/1.

dump(int) deprecated

Callback implementation for Ecto.Type.dump/1.

Callback implementation for Ecto.Type.embed_as/1.

Callback implementation for Ecto.Type.equal?/2.

load(int) deprecated

Callback implementation for Ecto.Type.load/1.

type() deprecated

Callback implementation for Ecto.Type.type/0.

Link to this section Functions

This function is deprecated. Use Money.Ecto.Amount.Type.cast/1 instead.
@spec cast(String.t() | integer()) :: {:ok, Money.t()}

Callback implementation for Ecto.Type.cast/1.

This function is deprecated. Use Money.Ecto.Amount.Type.dump/1 instead.
@spec dump(integer() | Money.t()) :: {:ok, :integer}

Callback implementation for Ecto.Type.dump/1.

Callback implementation for Ecto.Type.embed_as/1.

Callback implementation for Ecto.Type.equal?/2.

This function is deprecated. Use Money.Ecto.Amount.Type.load/1 instead.
@spec load(integer()) :: {:ok, Money.t()}

Callback implementation for Ecto.Type.load/1.

This function is deprecated. Use Money.Ecto.Amount.Type.type/0 instead.
@spec type() :: :integer

Callback implementation for Ecto.Type.type/0.