| 193 | } |
| 194 | |
| 195 | func 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 |