From 8d43b38287d2efd59774e43b80ad3bbb7ca33b54 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Thu, 18 Apr 2019 23:12:00 -0500 Subject: [PATCH] RowDescription.Name is now []byte Avoid allocation --- row_description.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/row_description.go b/row_description.go index dadfc80f..1b1734dc 100644 --- a/row_description.go +++ b/row_description.go @@ -14,7 +14,7 @@ const ( ) type FieldDescription struct { - Name string + Name []byte TableOID uint32 TableAttributeNumber uint16 DataTypeOID uint32 @@ -46,9 +46,8 @@ func (dst *RowDescription) Decode(src []byte) error { if idx < 0 { return &invalidMessageFormatErr{messageType: "RowDescription"} } - bName := string(src[rp : rp+idx]) + fd.Name = src[rp : rp+idx] rp += idx + 1 - fd.Name = string(bName[:len(bName)-1]) // Since buf.Next() doesn't return an error if we hit the end of the buffer // check Len ahead of time