Adapter (Adapter v1.0.0-rc0) View Source

Documentation for Adapter.

Link to this section Summary

Types

:app and :key.

Functions

Define the adapter behaviour through callbacks. A @doc tag can be set for each @callback.

Link to this section Types

Specs

option() ::
  {:app, atom()}
  | {:key, atom()}
  | {:default, module()}
  | {:error, :raise | atom()}
  | {:log, false | :debug | :info | :notice}
  | {:mode, :compile | :get_compiled | :get_env}
  | {:random, boolean()}
  | {:validate, boolean()}

:app and :key.

Link to this section Functions

Link to this macro

behavior(list)

View Source (macro)

Specs

behavior(callbacks :: [{:do, term()}]) :: term()

See Adapter.behaviour/1.

Link to this macro

behaviour(list)

View Source (macro)

Specs

behaviour(callbacks :: [{:do, term()}]) :: term()

Define the adapter behaviour through callbacks. A @doc tag can be set for each @callback.

Each callback is useable

Example

behaviour do
  @doc ~S\"""
  Get session from storage.
  \"""
  @callback get(token :: binary) :: {:ok, Session.t | nil} | {:error, atom}
end