Acme Bank v1.0.0-dev Money.Ecto
Provides custom Ecto type to use Money
.
It might work with different adapters, but it has only been tested on PostgreSQL as a composite type.
Usage:
Schema:
defmodule Item do
use Ecto.Schema
schema "items" do
field :name, :string
field :price, Money.Ecto
end
end
Migration:
def change do
execute "
CREATE TYPE moneyz AS (
cents integer,
currency varchar
);
"
create table(:items) do
add :name, :string
add :price, :moneyz
end
end
Summary
Functions
Callback implementation for Ecto.Type.cast/1
Callback implementation for Ecto.Type.dump/1
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.load/1
.
Callback implementation for Ecto.Type.type/0
.