Postgres module

connect

procedure · 1 overloadsince 0.27.0Source

Opens a connection and authenticates. On failure the connection is null and nothing needs closing. Must run on a fiber (Io.io_run); config.connect_timeout bounds each attempt.

With several hosts (Config.hosts) they are tried in order, or in a random order with load_balance_hosts RANDOM, until one accepts the login and has the role target_session_attrs asks for. connect_timeout limits each attempt.

connect :: (config: Config) -> (*Connection, Pg_Error)

Opens a connection and authenticates. On failure the connection is null and nothing needs closing. Must run on a fiber (Io.io_run); config.connect_timeout bounds each attempt.

With several hosts (Config.hosts) they are tried in order, or in a random order with load_balance_hosts RANDOM, until one accepts the login and has the role target_session_attrs asks for. connect_timeout limits each attempt.

Parameters

config: Config
where to connect and how to log in.

Returns

See also