pgconn.CommandTag is now an opaque type
It now makes a copy instead of retaining driver memory. This is in preparation to reuse the driver read buffer.
This commit is contained in:
@@ -10,7 +10,7 @@ type errBatchResults struct {
|
||||
}
|
||||
|
||||
func (br errBatchResults) Exec() (pgconn.CommandTag, error) {
|
||||
return nil, br.err
|
||||
return pgconn.CommandTag{}, br.err
|
||||
}
|
||||
|
||||
func (br errBatchResults) Query() (pgx.Rows, error) {
|
||||
@@ -18,7 +18,7 @@ func (br errBatchResults) Query() (pgx.Rows, error) {
|
||||
}
|
||||
|
||||
func (br errBatchResults) QueryFunc(scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error) {
|
||||
return nil, br.err
|
||||
return pgconn.CommandTag{}, br.err
|
||||
}
|
||||
|
||||
func (br errBatchResults) QueryRow() pgx.Row {
|
||||
|
||||
@@ -27,7 +27,7 @@ type execer interface {
|
||||
func testExec(t *testing.T, db execer) {
|
||||
results, err := db.Exec(context.Background(), "set time zone 'America/Chicago'")
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, "SET", results)
|
||||
assert.EqualValues(t, "SET", results.String())
|
||||
}
|
||||
|
||||
type queryer interface {
|
||||
|
||||
+2
-2
@@ -470,7 +470,7 @@ func (p *Pool) Stat() *Stat {
|
||||
func (p *Pool) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) {
|
||||
c, err := p.Acquire(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return pgconn.CommandTag{}, err
|
||||
}
|
||||
defer c.Release()
|
||||
|
||||
@@ -527,7 +527,7 @@ func (p *Pool) QueryRow(ctx context.Context, sql string, args ...interface{}) pg
|
||||
func (p *Pool) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error) {
|
||||
c, err := p.Acquire(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return pgconn.CommandTag{}, err
|
||||
}
|
||||
defer c.Release()
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +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) CommandTag() pgconn.CommandTag { return pgconn.CommandTag{} }
|
||||
func (errRows) FieldDescriptions() []pgproto3.FieldDescription { return nil }
|
||||
func (errRows) Next() bool { return false }
|
||||
func (e errRows) Scan(dest ...interface{}) error { return e.err }
|
||||
|
||||
Reference in New Issue
Block a user