Ecto.Adapters.Connection behaviour

Behaviour for connection processes.

In order to use a connection, adapter developers need to implement two callbacks in a module, connect/1 and disconnect/1 defined in this module. The connection is started by passing the module that implements the callbacks and as well as the connection arguments.

Source

Callbacks

connect/1

Specs:

  • connect(Keyword.t) :: {:ok, pid} | {:error, term}

Connects to the underlying database.

Should return a process which is linked to the caller process or an error.

Source
disconnect/1

Specs:

  • disconnect(pid) :: :ok

Disconnects the given pid.

If the given pid no longer exists, it should not raise.

Source