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.
- config: where to connect and how to log in.
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.