Ecto v1.1.0 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.

Summary

Functions

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

Shutdown the given connection pid

Callbacks

Connects to the underlying database

Functions

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)

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.

Callbacks

connect(arg0)

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.