elixir-waffle / waffle_ecto

Waffle.Ecto provides an integration with Waffle and Ecto
https://hexdocs.pm/waffle_ecto
112 stars 30 forks source link

Check for the new using block in Ecto 3.2 #5

Closed achempion closed 5 years ago

achempion commented 5 years ago

to address the https://github.com/stavro/arc_ecto/pull/120 and https://github.com/stavro/arc_ecto/issues/119

from @Kuret:

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

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.

achempion commented 5 years ago

@Kuret thank you for PR!