MCPcopy
hub / github.com/jackc/pgx / ConnectWithOptions

Function ConnectWithOptions

pgconn/pgconn.go:127–134  ·  view source on GitHub ↗

Connect establishes a connection to a PostgreSQL server using the environment and connString (in URL or keyword/value format) and ParseConfigOptions to provide additional configuration. See documentation for [ParseConfig] for details. ctx can be used to cancel a connect attempt.

(ctx context.Context, connString string, parseConfigOptions ParseConfigOptions)

Source from the content-addressed store, hash-verified

125// format) and ParseConfigOptions to provide additional configuration. See documentation for [ParseConfig] for details.
126// ctx can be used to cancel a connect attempt.
127func ConnectWithOptions(ctx context.Context, connString string, parseConfigOptions ParseConfigOptions) (*PgConn, error) {
128 config, err := ParseConfigWithOptions(connString, parseConfigOptions)
129 if err != nil {
130 return nil, err
131 }
132
133 return ConnectConfig(ctx, config)
134}
135
136// Connect establishes a connection to a PostgreSQL server using config. config must have been constructed with
137// [ParseConfig]. ctx can be used to cancel a connect attempt.

Callers 1

TestConnectWithOptionsFunction · 0.92

Calls 2

ParseConfigWithOptionsFunction · 0.70
ConnectConfigFunction · 0.70

Tested by 1

TestConnectWithOptionsFunction · 0.74