elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
827 stars 141 forks source link

Check for the new using block for Ecto.Type in Ecto 3.2 #112

Closed Kuret closed 5 years ago

Kuret commented 5 years ago

https://github.com/elixir-ecto/ecto/blob/d8ae5564a17f5b0a40962d81ef71360560210f12/lib/ecto/type.ex#L83 https://github.com/elixir-ecto/ecto/blob/v3.2.0/CHANGELOG.md https://github.com/elixir-waffle/waffle_ecto/pull/5

From the Ecto changelog:

[Ecto.Type] Add a new embed_as/1 callback to Ecto.Type that allows adapters to control embedding behaviour
[Ecto.Type] Add use Ecto.Type for convenience that implements the new required callbacks

Ecto added a new __using__ block for Ecto.Type which implements the behaviour + the new required functions.

This PR checks if Ecto.Type can be used, and otherwise just implements the @behaviour, to maintain compatibility with Ecto < 3.2.0.

Nitrino commented 5 years ago

@Kuret Thanks 🔥