OptionShouldPing controls whether stdlib should issue a liveness ping before reusing a connection. If the function returns true, stdlib will ping. If it returns false, stdlib will skip the ping. If not provided, default is ping only when IdleDuration > 1s.
(f func(context.Context, ShouldPingParams) bool)
| 137 | // If it returns false, stdlib will skip the ping. |
| 138 | // If not provided, default is ping only when IdleDuration > 1s. |
| 139 | func OptionShouldPing(f func(context.Context, ShouldPingParams) bool) OptionOpenDB { |
| 140 | return func(dc *connector) { dc.ShouldPing = f } |
| 141 | } |
| 142 | |
| 143 | // OptionBeforeConnect provides a callback for before connect. It is passed a shallow copy of the ConnConfig that will |
| 144 | // be used to connect, so only its immediate members should be modified. Used only if db is opened with *pgx.ConnConfig. |
no outgoing calls