diff --git a/convert.go b/convert.go index f170e05b..45c226be 100644 --- a/convert.go +++ b/convert.go @@ -433,25 +433,6 @@ func GetAssignToDstType(dst interface{}) (interface{}, bool) { return nil, false } -// EncodeRow builds a binary representation of row values (row(), composite types) -func EncodeRow(ci *ConnInfo, buf []byte, fields ...Value) (newBuf []byte, err error) { - b := NewCompositeBinaryBuilder(ci, buf) - - for _, f := range fields { - dt, ok := ci.DataTypeForValue(f) - if !ok { - return nil, errors.Errorf("Unknown OID for %s", f) - } - binaryEncoder, ok := f.(BinaryEncoder) - if !ok { - return nil, errors.Errorf("record field doesn't implement binary encoding: %s", reflect.TypeOf(f).Name()) - } - b.AppendEncoder(dt.OID, binaryEncoder) - } - - return b.Finish() -} - func init() { kindTypes = map[reflect.Kind]reflect.Type{ reflect.Bool: reflect.TypeOf(false), diff --git a/custom_composite_test.go b/custom_composite_test.go index a93a8ad0..296fcc90 100644 --- a/custom_composite_test.go +++ b/custom_composite_test.go @@ -36,7 +36,7 @@ func (src MyType) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) (newBuf []byte, b = pgtype.Text{Status: pgtype.Null} } - return pgtype.EncodeRow(ci, buf, &a, &b) + return (pgtype.CompositeFields{&a, &b}).EncodeBinary(ci, buf) } func ptrS(s string) *string {