Current section
Files
Jump to
Current section
Files
lib/custom_schema.ex
import ProtocolEx
defprotocol_ex Mecto.CustomSchema do
@moduledoc """
The `protocol_ex` protocol used to create schemas for custom Ecto types.
"""
def type(module, field)
end
defimpl_ex Ecto.Enum, Ecto.Enum, for: Mecto.CustomSchema do
@moduledoc """
Implementation of `Mecto.CustomSchema` for `Ecto.Enum`, using `protocol_ex`.
"""
def type(Ecto.Enum, %{type: type}), do: type
end