diff --git a/lib/ash_money/types/money.ex b/lib/ash_money/types/money.ex index c88443d..976dd2b 100644 --- a/lib/ash_money/types/money.ex +++ b/lib/ash_money/types/money.ex @@ -1,6 +1,16 @@ defmodule AshMoney.Types.Money do @moduledoc """ A money type for Ash that uses the `ex_money` library. + + When constructing a composite type, use a tuple in the following structure: + + `composite_type({"USD", Decimal.new("0")}, AshMoney.Types.Money)` + + If you've added a custom type, like `:money`: + + ```elixir + composite_type({"USD", Decimal.new("0")}, :money) + ``` """ use Ash.Type diff --git a/mix.exs b/mix.exs index ffd3f11..aa13dff 100644 --- a/mix.exs +++ b/mix.exs @@ -145,6 +145,7 @@ defmodule AshMoney.MixProject do {:ash, ash_version("~> 2.0 and >= 2.17.6")}, {:ex_money, "~> 5.15"}, {:ex_money_sql, "~> 1.0"}, + {:ash_postgres, "~> 1.0", optional: true}, {:ex_doc, github: "elixir-lang/ex_doc", only: [:dev, :test], runtime: false}, {:ex_check, "~> 0.12", only: [:dev, :test]}, {:credo, ">= 0.0.0", only: [:dev, :test], runtime: false}, diff --git a/mix.lock b/mix.lock index a31288a..fcf4a7d 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,6 @@ %{ "ash": {:hex, :ash, "2.17.6", "fcc2512f8245673674a839bc4221b047b88234e5c4ad56e36501d6848a59df5b", [:mix], [{:comparable, "~> 1.0", [hex: :comparable, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:earmark, "~> 1.4", [hex: :earmark, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: false]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:spark, ">= 1.1.50 and < 2.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}, {:stream_data, "~> 0.6", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d5e69ba8742684299078c77b90ee82f3bd198d96ca232e8ca03e4f91c1f598ab"}, + "ash_postgres": {:hex, :ash_postgres, "1.3.62", "e8b661a0a88a771f7139dcd7c9632cc140f9b05c278cc0ee297638cb47782c1f", [:mix], [{:ash, ">= 2.17.3 and < 3.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}], "hexpm", "99e5702f72ec54d65a2571bebb89e3867ca7220eeca7c89aa7935dcf6e0cc0a7"}, "bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"}, "cldr_utils": {:hex, :cldr_utils, "2.24.2", "364fa30be55d328e704629568d431eb74cd2f085752b27f8025520b566352859", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "3362b838836a9f0fa309de09a7127e36e67310e797d556db92f71b548832c7cf"}, "comparable": {:hex, :comparable, "1.0.0", "bb669e91cedd14ae9937053e5bcbc3c52bb2f22422611f43b6e38367d94a495f", [:mix], [{:typable, "~> 0.1", [hex: :typable, repo: "hexpm", optional: false]}], "hexpm", "277c11eeb1cd726e7cd41c6c199e7e52fa16ee6830b45ad4cdc62e51f62eb60c"},