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

Function GetConnector

stdlib/sql.go:195–208  ·  view source on GitHub ↗
(config pgx.ConnConfig, opts ...OptionOpenDB)

Source from the content-addressed store, hash-verified

193}
194
195func GetConnector(config pgx.ConnConfig, opts ...OptionOpenDB) driver.Connector {
196 c := connector{
197 ConnConfig: config,
198 BeforeConnect: func(context.Context, *pgx.ConnConfig) error { return nil }, // noop before connect by default
199 AfterConnect: func(context.Context, *pgx.Conn) error { return nil }, // noop after connect by default
200 ResetSession: func(context.Context, *pgx.Conn) error { return nil }, // noop reset session by default
201 driver: pgxDriver,
202 }
203
204 for _, opt := range opts {
205 opt(&c)
206 }
207 return c
208}
209
210// GetPoolConnector creates a new driver.Connector from the given *pgxpool.Pool. By using this be sure to set the
211// maximum idle connections of the *sql.DB created with this connector to zero since they must be managed from the

Callers 1

OpenDBFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected