2
0

Use pgproto3.FieldDescription instead of pgx version

This allows removing a malloc and memcpy.
This commit is contained in:
Jack Christensen
2019-05-04 13:47:03 -05:00
parent ea31df3b50
commit 583c8d3b25
7 changed files with 97 additions and 140 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"io"
"github.com/jackc/pgio"
"github.com/jackc/pgtype"
errors "golang.org/x/xerrors"
)
@@ -129,7 +130,7 @@ func (ct *copyFrom) buildCopyBuf(buf []byte, ps *PreparedStatement) (bool, []byt
buf = pgio.AppendInt16(buf, int16(len(ct.columnNames)))
for i, val := range values {
buf, err = encodePreparedStatementArgument(ct.conn.ConnInfo, buf, ps.FieldDescriptions[i].DataType, val)
buf, err = encodePreparedStatementArgument(ct.conn.ConnInfo, buf, pgtype.OID(ps.FieldDescriptions[i].DataTypeOID), val)
if err != nil {
return false, nil, err
}