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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user