for TxAccessMode, TxDeferrableMode and TxIsoLevel
After this commit, Godoc understands these are the valid values of these
types and shows them together in the documentation.
Otherwise the health check and the create initial connection(s) may both
create connections. While this generally wouldn't be a real problem it
did cause TestPoolBackgroundChecksMinConns to flicker on CI.
This change introduces a new zerologadapter that allows
users to pass the actual logger via context.Context. Especially HTTP
middleware might choose to use `(*zerolog.Logger).WithContext` and
`zerolog.Ctx`. Allowing users to extract the logger from the context
keeps the full enriched logger available when pgx emits logs.
WithContextFunc adds possibility to get request scoped values from the
ctx.Context before logging lines.
WithoutPGXModule disables adding module:pgx to the default logger context.
zap.Any falls back to zap.Reflect, but is better for this case, because
it first checks for the types that zap handles specially. For example,
time.Duration, or error, which zap.Reflect will just treat as untyped
int64 or struct objects, but zap.Any is able to detect these types and
print them properly.
Previously, stdlib.RegisterConnConfig would sometimes reuse the same connection
string for different ConnConfig options (specifically, it happened when a connection
was open and then closed, and then a new, different connection was opened). This
behavior interferes with callers that expect that two connections with the same data
source name are connecting to the same backend database in the same way.
This fix updates stdlib.RegisterConnConfig to use an incrementing sequence
counter to uniquify all returned connection strings.
Fixes#947