mirror of
https://github.com/ash-project/ash_money.git
synced 2024-09-17 03:43:07 +12:00
improvement: update igniter and document installers
This commit is contained in:
parent
5811d00dd3
commit
5843ee7468
4 changed files with 16 additions and 9 deletions
|
@ -13,6 +13,16 @@ end
|
|||
|
||||
## Setup
|
||||
|
||||
<!-- tabs-open -->
|
||||
|
||||
### Using Igniter (recommended)
|
||||
|
||||
```bash
|
||||
mix igniter.install ash_money
|
||||
```
|
||||
|
||||
### Manual
|
||||
|
||||
The primary thing that AshMoney provides is `AshMoney.Types.Money`. This is backed by `ex_money`. You can use it out of the box like so:
|
||||
|
||||
```elixir
|
||||
|
@ -65,6 +75,8 @@ defmodule YourRepo do
|
|||
end
|
||||
```
|
||||
|
||||
<!-- tabs-close -->
|
||||
|
||||
## AshGraphql Support
|
||||
|
||||
Add the following to your schema file:
|
||||
|
@ -80,8 +92,3 @@ Add the following to your schema file:
|
|||
field(:currency, non_null(:string))
|
||||
end
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
Support for using built in operators with data layers that don't support it. For example, `expr(money + money)` will work in `AshPostgres`, but not when using `Ash.DataLayer.Ets`.
|
||||
We need to make built in functions extensible by type to make this work.
|
|
@ -15,7 +15,7 @@ defmodule Mix.Tasks.AshMoney.AddToAshPostgres do
|
|||
case Igniter.Code.Module.move_to_use(zipper, AshPostgres.Repo) do
|
||||
# discarding since we just needed to check that `use AshPostgres.Repo` exists
|
||||
{:ok, _zipper} ->
|
||||
case Igniter.Code.Module.move_to_def(zipper, :installed_extensions, 0) do
|
||||
case Igniter.Code.Function.move_to_def(zipper, :installed_extensions, 0) do
|
||||
{:ok, zipper} ->
|
||||
case Igniter.Code.Common.move_right(zipper, &Igniter.Code.List.list?/1) do
|
||||
{:ok, zipper} ->
|
||||
|
@ -49,6 +49,6 @@ defmodule Mix.Tasks.AshMoney.AddToAshPostgres do
|
|||
{:error, "Couldn't find `use AshPostgres.Repo` in #{inspect(repo_module_name)}"}
|
||||
end
|
||||
end)
|
||||
|> Igniter.add_task("ash.codegen", ["install_ash_money_extension"])
|
||||
|> Ash.Igniter.codegen("install_ash_money")
|
||||
end
|
||||
end
|
||||
|
|
2
mix.exs
2
mix.exs
|
@ -105,6 +105,7 @@ defmodule AshMoney.MixProject do
|
|||
[
|
||||
{:ash, ash_version("~> 3.0 and >= 3.0.15")},
|
||||
{:ex_money, "~> 5.15"},
|
||||
{:igniter, "~> 0.2 and >= 0.2.13"},
|
||||
{:ex_money_sql, "~> 1.0", optional: true},
|
||||
{:ash_postgres, "~> 2.0", optional: true},
|
||||
{:ash_graphql, "~> 1.0", optional: true},
|
||||
|
@ -117,7 +118,6 @@ defmodule AshMoney.MixProject do
|
|||
{:git_ops, "~> 2.5", only: [:dev, :test]},
|
||||
{:mix_test_watch, "~> 1.0", only: :dev, runtime: false},
|
||||
{:mix_audit, ">= 0.0.0", only: [:dev, :test], runtime: false},
|
||||
{:igniter, "~> 0.2.5"}
|
||||
]
|
||||
end
|
||||
|
||||
|
|
2
mix.lock
2
mix.lock
|
@ -32,7 +32,7 @@
|
|||
"git_ops": {:hex, :git_ops, "2.6.1", "cc7799a68c26cf814d6d1a5121415b4f5bf813de200908f930b27a2f1fe9dad5", [:mix], [{:git_cli, "~> 0.2", [hex: :git_cli, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "ce62d07e41fe993ec22c35d5edb11cf333a21ddaead6f5d9868fcb607d42039e"},
|
||||
"glob_ex": {:hex, :glob_ex, "0.1.7", "eae6b6377147fb712ac45b360e6dbba00346689a87f996672fe07e97d70597b1", [:mix], [], "hexpm", "decc1c21c0c73df3c9c994412716345c1692477b9470e337f628a7e08da0da6a"},
|
||||
"hpax": {:hex, :hpax, "1.0.0", "28dcf54509fe2152a3d040e4e3df5b265dcb6cb532029ecbacf4ce52caea3fd2", [:mix], [], "hexpm", "7f1314731d711e2ca5fdc7fd361296593fc2542570b3105595bb0bc6d0fad601"},
|
||||
"igniter": {:hex, :igniter, "0.2.12", "e2e8fbb15effecb433f4096edbb0754282553544c75c3130d06ca09bdaa1fb13", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:nimble_options, "~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:req, "~> 0.4", [hex: :req, repo: "hexpm", optional: false]}, {:rewrite, "~> 0.9", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "51f3487a13441cd3e6e0d559689f8b0ba2c716834f86802e8a6760fdd1a2e579"},
|
||||
"igniter": {:hex, :igniter, "0.2.13", "dbf743887f73de135f38a121e31dd16ce29ea355b1de85c876848fecf335ca0a", [:mix], [{:glob_ex, "~> 0.1.7", [hex: :glob_ex, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:nimble_options, "~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:rewrite, "~> 0.9", [hex: :rewrite, repo: "hexpm", optional: false]}, {:sourceror, "~> 1.4", [hex: :sourceror, repo: "hexpm", optional: false]}, {:spitfire, ">= 0.1.3 and < 1.0.0-0", [hex: :spitfire, repo: "hexpm", optional: false]}], "hexpm", "f6e7e98ac9f42ca5fa6121d4212c6d462049e43fbf91ec56e3b2cf2895eba86b"},
|
||||
"jason": {:hex, :jason, "1.4.3", "d3f984eeb96fe53b85d20e0b049f03e57d075b5acda3ac8d465c969a2536c17b", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9a90e868927f7c777689baa16d86f4d0e086d968db5c05d917ccff6d443e58a3"},
|
||||
"libgraph": {:hex, :libgraph, "0.16.0", "3936f3eca6ef826e08880230f806bfea13193e49bf153f93edcf0239d4fd1d07", [:mix], [], "hexpm", "41ca92240e8a4138c30a7e06466acc709b0cbb795c643e9e17174a178982d6bf"},
|
||||
"makeup": {:hex, :makeup, "1.1.1", "fa0bc768698053b2b3869fa8a62616501ff9d11a562f3ce39580d60860c3a55e", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "5dc62fbdd0de44de194898b6710692490be74baa02d9d108bc29f007783b0b48"},
|
||||
|
|
Loading…
Reference in a new issue