2
0

Add CommandTag to Rows interface

This allows handling queries where it is unknown if there will be a
result set or not. If it is not a result set returning query the
command tag will still be available.
This commit is contained in:
Jack Christensen
2019-09-02 09:53:26 -05:00
parent 0ef89ae0b7
commit b5ce0220f8
3 changed files with 43 additions and 11 deletions
+6
View File
@@ -1,6 +1,7 @@
package pgxpool
import (
"github.com/jackc/pgconn"
"github.com/jackc/pgproto3/v2"
"github.com/jackc/pgx/v4"
)
@@ -11,6 +12,7 @@ type errRows struct {
func (errRows) Close() {}
func (e errRows) Err() error { return e.err }
func (errRows) CommandTag() pgconn.CommandTag { return nil }
func (errRows) FieldDescriptions() []pgproto3.FieldDescription { return nil }
func (errRows) Next() bool { return false }
func (e errRows) Scan(dest ...interface{}) error { return e.err }
@@ -43,6 +45,10 @@ func (rows *poolRows) Err() error {
return rows.r.Err()
}
func (rows *poolRows) CommandTag() pgconn.CommandTag {
return rows.CommandTag()
}
func (rows *poolRows) FieldDescriptions() []pgproto3.FieldDescription {
return rows.r.FieldDescriptions()
}