Ecto.Adapter behaviour
This module specifies the adapter API that an adapter is required to implement.
Types ↑
t :: module
Callbacks
The callback invoked when the adapter is used.
Specs:
- all(repo :: Ecto.Repo.t, query :: Ecto.Query.t, params :: %{}, opts :: Keyword.t) :: [[term]] | no_return
Fetches all results from the data store based on the given query.
Specs:
- delete(repo :: Ecto.Repo.t, source :: binary, filter :: Keyword.t, opts :: Keyword.t) :: :ok | no_return
Deletes a model using the primary key as key.
Specs:
- delete_all(repo :: Ecto.Repo.t, query :: Ecto.Query.t, params :: %{}, opts :: Keyword.t) :: integer | no_return
Deletes all entities matching the given query.
The query shall only have where
expressions and a from
expression.
Returns the number of affected entities.
Specs:
- insert(repo :: Ecto.Repo.t, source :: binary, fields :: Keyword.t, opts :: Keyword.t) :: tuple | no_return
Stores a single new model in the data store.
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.
Specs:
- stop(repo :: Ecto.Repo.t) :: :ok
Stops any connection pooling or supervision started with start_link/1
.
Specs:
- update(repo :: Ecto.Repo.t, source :: binary, filter :: Keyword.t, fields :: Keyword.t, opts :: Keyword.t) :: tuple | no_return
Updates a model using the primary key as key.
Specs:
- update_all(repo :: Ecto.Repo.t, query :: Ecto.Query.t, filter :: Keyword.t, params :: %{}, opts :: Keyword.t) :: integer | no_return
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.