Pax.Adapter behaviour (Pax v0.0.1-dev)
View SourceSummary
Callbacks
A function that returns a valid Pax.Config spec for configuration keys and types accepted by the adapter.
The adapter initialization function, must return a map of initialized adapter state.
A function that merges any additional configuration options into the adapter's opts map.
Types
@type adapter_module() :: module()
@type callback_module() :: module()
@type socket() :: Phoenix.LiveView.Socket.t()
A Phoenix.LiveView socket
@type unsigned_params() :: Phoenix.LiveView.unsigned_params()
Unsigned params from a Phoenix.LiveView handle_params/3
Callbacks
@callback cast(opts(), object(), unsigned_params(), fields :: [Pax.Field.t()]) :: Ecto.Changeset.t()
A function that returns a valid Pax.Config spec for configuration keys and types accepted by the adapter.
@callback create_object(opts(), object(), Ecto.Changeset.t()) :: {:ok, map()} | {:error, Ecto.Changeset.t()}
@callback default_fields(opts()) :: Pax.Index.fields()
@callback init(callback_module(), opts :: []) :: opts()
The adapter initialization function, must return a map of initialized adapter state.
A function that merges any additional configuration options into the adapter's opts map.
@callback object_ids(opts(), object()) :: [String.Chars.t()] | nil
@callback update_object(opts(), object(), Ecto.Changeset.t()) :: {:ok, map()} | {:error, Ecto.Changeset.t()}
Functions
@spec cast(t(), object(), unsigned_params(), fields :: [Pax.Field.t()]) :: Ecto.Changeset.t()
@spec default_fields(t()) :: Pax.Index.fields()
@spec object_ids(t(), object()) :: [String.Chars.t()]
@spec update_object(t(), object(), Ecto.Changeset.t()) :: {:ok, any()} | {:error, Ecto.Changeset.t()}
@spec update_object(t(), object(), Ecto.Changeset.t()) :: {:ok, any()} | {:error, Ecto.Changeset.t()}