Ecto.Adapters.Postgres
This is the adapter module for PostgreSQL. It handles and pools the connections to the postgres database with poolboy.
Options
The options should be given via Ecto.Repo.conf/0
.
:hostname
- Server hostname:port
- Server port (default: 5432):username
- Username:password
- User password:size
- The number of connections to keep in the pool:max_overflow
- The maximum overflow of connections (see poolboy docs):parameters
- Keyword list of connection parameters:ssl
- Set to true if ssl should be used (default: false):ssl_opts
- A list of ssl options, see ssl docs:lazy
- If false all connections will be started immediately on Repo startup (default: true)
Summary↑
query(repo, sql, params, opts \\ []) | Run custom SQL query on given repo |
Functions
Run custom SQL query on given repo.
Options
:timeout
- The time in milliseconds to wait for the call to finish,
:infinity
will wait indefinitely (default: 5000);
Examples
iex> Postgres.query(MyRepo, "SELECT $1 + $2", [40, 2])
%Postgrex.Result{command: :select, columns: ["?column?"], rows: [{42}], num_rows: 1}