2
0

Add context.Context to Logger interface

This allows custom logger adapters to add additional fields to log
messages. For example, a HTTP server may with to log the request ID.

fixes #428
This commit is contained in:
Jack Christensen
2019-08-03 16:16:21 -05:00
parent ab1edc79e0
commit 3028821487
11 changed files with 68 additions and 22 deletions
+4 -1
View File
@@ -1,6 +1,8 @@
package pgx
import (
"context"
"github.com/jackc/pgconn"
"github.com/jackc/pgtype"
errors "golang.org/x/xerrors"
@@ -47,6 +49,7 @@ type BatchResults interface {
}
type batchResults struct {
ctx context.Context
conn *Conn
mrr *pgconn.MultiResultReader
err error
@@ -71,7 +74,7 @@ func (br *batchResults) ExecResults() (pgconn.CommandTag, error) {
// QueryResults reads the results from the next query in the batch as if the query has been sent with Query.
func (br *batchResults) QueryResults() (Rows, error) {
rows := br.conn.getRows("batch query", nil)
rows := br.conn.getRows(br.ctx, "batch query", nil)
if br.err != nil {
rows.err = br.err