Skip to content

Commit 98899ec

Browse files
committed
Improve repo docs
1 parent c8ba08c commit 98899ec

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

lib/ecto/repo.ex

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,31 @@ defmodule Ecto.Repo do
9797
config :my_app, Repo,
9898
url: "ecto://postgres:postgres@localhost/ecto_simple?ssl=true&pool_size=10"
9999
100+
### IPv6 support
101+
102+
If your database's host resolves to ipv6 address you should
103+
add `socket_options: [:inet6]` to configuration block like below:
104+
105+
import Mix.Config
106+
107+
config :my_app, MyApp.Repo,
108+
hostname: "db12.dc0.comp.any",
109+
socket_options: [:inet6],
110+
...
111+
112+
## `use` options
113+
114+
When you `use Ecto.Repo`, the following options are supported:
115+
116+
* `:otp_app` (required) - the name of the Erlang/OTP application
117+
to find your repository configuration (usually your Elixir app name)
118+
119+
* `:adapter` (required) - the module of the database adapter you want to use
120+
121+
* `:read_only` - when true, marks the repository as `:read_only`.
122+
In such cases, none of the functions that perform write operations, such as
123+
`c:insert/2`, `c:insert_all/3`, `c:update_all/3`, and friends are defined
124+
100125
## Shared options
101126
102127
Almost all of the repository functions outlined in this module accept the following
@@ -187,16 +212,6 @@ defmodule Ecto.Repo do
187212
* `:options` - extra options given to the repo operation under
188213
`:telemetry_options`
189214
190-
## Read-only repositories
191-
192-
You can mark a repository as read-only by passing the `:read_only`
193-
flag on `use`:
194-
195-
use Ecto.Repo, otp_app: ..., adapter: ..., read_only: true
196-
197-
By passing the `:read_only` option, none of the functions that perform
198-
write operations, such as `c:insert/2`, `c:insert_all/3`, `c:update_all/3`,
199-
and friends will be defined.
200215
"""
201216

202217
@type t :: module

0 commit comments

Comments
 (0)