FastDecimal.Ecto.Type (FastDecimal v1.0.1)

Copy Markdown View Source

Ecto.Type implementation for FastDecimal. Lets you use FastDecimal as the value type for numeric / decimal columns.

defmodule MyApp.Invoice do
  use Ecto.Schema

  schema "invoices" do
    field :total, FastDecimal.Ecto.Type
  end
end

The database adapter (e.g. postgrex) speaks Decimal over the wire — this type converts at the boundary so the database stays compatible while your Elixir code holds %FastDecimal{} structs.