Ecto を 3.1.7 から 3.2.2 にアップデートしたところ、コンパイル時に大量の warning が出るようになってしまった。
warning: function embed_as/1 required by behaviour Ecto.Type is not implemented (in module MyApp.Ecto.SecretKey)
lib/myapp/ecto/secret_key.ex:1: MyApp.Ecto.SecretKey (module)
warning: function equal?/2 required by behaviour Ecto.Type is not implemented (in module MyApp.Ecto.SecretKey)
lib/myapp/ecto/secret_key.ex:1: MyApp.Ecto.SecretKey (module)
warning: function embed_as/1 required by behaviour Ecto.Type is not implemented (in module MyApp.Ecto.RandomSecretKey20)
lib/myapp/ecto/random_secret_key.ex:42: MyApp.Ecto.RandomSecretKey20 (module)
warning: function equal?/2 required by behaviour Ecto.Type is not implemented (in module MyApp.Ecto.RandomSecretKey20)
lib/myapp/ecto/random_secret_key.ex:42: MyApp.Ecto.RandomSecretKey20 (module)
Ecto.Type の @callback
に追加された embed_as/1
や equal?/2
が、use Ecto.Type
の導入に伴い @optional_callback
から外されたのが原因のようだ。
自分のプロジェクトで @behaviour Ecto.Type
をしている箇所を use Ecto.Type
に置き換えれば、デフォルトの実装を提供してくれるので、上記の warning は収まる。
- @behaviour Ecto.Type
+ use Ecto.Type