DAL v0.3.0 DAL.Repo
Helpers for introspecting on schemas and repos related to DAL usage
Link to this section Summary
Functions
Given an app_name
, returns a unique list of repos that all schema
implementations point to. app_name
is the same one would pass for your
app:
key under your project
definition in ones mix.exs
. e.g
Link to this section Functions
Link to this function
repos(app_name)
Link to this function
repos!(app_name)
Given an app_name
, returns a unique list of repos that all schema
implementations point to. app_name
is the same one would pass for your
app:
key under your project
definition in ones mix.exs
. e.g.
defmodule MyProject.Mixfile do
def project do
[
app: my_project
<...snip...>
]
end
<...snip...>
end
with a repo
defmodule MyProject.Repo.MyRepo do
use Ecto.Repo, otp_app: :my_project
<...snip...>
end
and an implementation
defmodule MyProject.Schema.MySchema do
<...snip...>
defimpl DAL.Repo.Discoverable do
def repo(_), do: MyProject.Repo.MyRepo
end
end
can be used as:
iex> DAL.Repo.repos(:my_project)
[MyProject.Repo.MyRepo]
This is particularly useful for tests where one may call
setup_all do
:ok = DAL.Sandbox.checkout_all_as_shared(DAL.Repo.repos(:my_project))
edn
Link to this function