Ecto.Adapters.Connection behaviour

Behaviour for adapters that rely on connections.

In order to use a connection, adapter developers need to implement a single callback in a module: connect/1 defined in this module.

The benefits of implementing this module is that the adapter can then be used with all the different pools provided by Ecto.

Source

Summary

connect(module, opts)

Executes the connect in the given module, ensuring the repository’s after_connect/1 is invoked in the process

shutdown(pid, shutdown \\ 5000)

Shutdown the given connection pid

Functions

connect(module, opts)

Executes the connect in the given module, ensuring the repository’s after_connect/1 is invoked in the process.

Source
shutdown(pid, shutdown \\ 5000)

Specs:

  • shutdown(pid, timeout | :brutal_kill) :: :ok

Shutdown the given connection pid.

If pid does not exit within timeout it is killed, or it is killed immediately if :brutal_kill.

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