2
0

pgtype.OID type should only be used for scanning and encoding values

It was a mistake to use it in other contexts. This made interop
difficult between pacakges that depended on pgtype such as pgx and
packages that did not like pgconn and pgproto3. In particular this was
awkward for prepared statements.

This is preparation for removing pgx.PreparedStatement in favor of
pgconn.PreparedStatement.
This commit is contained in:
Jack Christensen
2019-08-24 13:55:57 -05:00
parent 7385349950
commit 6972a57421
14 changed files with 80 additions and 49 deletions
+2 -3
View File
@@ -4,14 +4,13 @@ import (
"context"
"github.com/jackc/pgconn"
"github.com/jackc/pgtype"
errors "golang.org/x/xerrors"
)
type batchItem struct {
query string
arguments []interface{}
parameterOIDs []pgtype.OID
parameterOIDs []uint32
resultFormatCodes []int16
}
@@ -24,7 +23,7 @@ type Batch struct {
// Queue queues a query to batch b. query can be an SQL query or the name of a prepared statement. parameterOIDs and
// resultFormatCodes should be nil if query is a prepared statement. Otherwise, parameterOIDs are required if there are
// parameters and resultFormatCodes are required if there is a result.
func (b *Batch) Queue(query string, arguments []interface{}, parameterOIDs []pgtype.OID, resultFormatCodes []int16) {
func (b *Batch) Queue(query string, arguments []interface{}, parameterOIDs []uint32, resultFormatCodes []int16) {
b.items = append(b.items, &batchItem{
query: query,
arguments: arguments,