Ecto.Adapter behaviour

This module specifies the adapter API that an adapter is required to implement.

Source

Types

t :: module

Callbacks

all/4

Specs:

Fetches all results from the data store based on the given query.

Source
delete/4

Specs:

Deletes a sigle model with the given filters.

While filter can be any record column, it is expected that at least the primary key (or any other key that uniquely identifies an existing record) to be given as filter. Therefore, in case there is no record matching the given filters, {:error, :stale} is returned.

Source
delete_all/4

Specs:

Deletes all entities matching the given query.

The query shall only have where expressions and a from expression. Returns the number of affected entities.

Source
insert/5

Specs:

Inserts a single new model in the data store.

Source
start_link/2

Specs:

  • start_link(repo :: Ecto.Repo.t, options :: Keyword.t) :: {:ok, pid} | :ok | {:error, {:already_started, pid}} | {:error, term}

Starts any connection pooling or supervision and return {:ok, pid} or just :ok if nothing needs to be done.

Returns {:error, {:already_started, pid}} if the repo already started or {:error, term} in case anything else goes wrong.

Source
stop/1

Specs:

Stops any connection pooling or supervision started with start_link/1.

Source
update/6

Specs:

Updates a single model with the given filters.

While filter can be any record column, it is expected that at least the primary key (or any other key that uniquely identifies an existing record) to be given as filter. Therefore, in case there is no record matching the given filters, {:error, :stale} is returned.

Source
update_all/5

Specs:

Updates all entities matching the given query with the values given. The query shall only have where expressions and a single from expression. Returns the number of affected entities.

Source