View Source Pow.Extension.Ecto.Schema.Base behaviour (Pow v1.0.29)

Used for extensions to extend user schemas.

The macro will add fallback functions to the module, that can be overridden.

usage

Usage

defmodule MyPowExtension.Ecto.Schema do
  use Pow.Extension.Ecto.Schema.Base

  @impl true
  def attrs(_config) do
    [{:custom_field, :string}]
  end

  @impl true
  def changeset(changeset, _config) do
    Ecto.Changeset.validate_required(changeset, [:custom_field])
  end
end

Link to this section Summary

Link to this section Callbacks

@macrocallback __using__(Pow.Config.t()) :: Macro.t()
@callback assocs(Pow.Config.t()) :: [tuple()]
@callback attrs(Pow.Config.t()) :: [tuple()]
@callback changeset(Ecto.Changeset.t(), map(), Pow.Config.t()) :: Ecto.Changeset.t()
@callback indexes(Pow.Config.t()) :: [tuple()]
@callback validate!(Pow.Config.t(), atom()) :: :ok