2
0

Fix Rows.Values() fallback to generic decoder

fixes #666
This commit is contained in:
Jack Christensen
2020-01-23 20:41:22 -06:00
parent 07b32353a4
commit f6feb39655
2 changed files with 24 additions and 4 deletions
+4 -4
View File
@@ -214,8 +214,8 @@ func (rows *connRows) Values() ([]interface{}, error) {
switch fd.Format {
case TextFormatCode:
decoder := value.(pgtype.TextDecoder)
if decoder == nil {
decoder, ok := value.(pgtype.TextDecoder)
if !ok {
decoder = &pgtype.GenericText{}
}
err := decoder.DecodeText(rows.connInfo, buf)
@@ -224,8 +224,8 @@ func (rows *connRows) Values() ([]interface{}, error) {
}
values = append(values, decoder.(pgtype.Value).Get())
case BinaryFormatCode:
decoder := value.(pgtype.BinaryDecoder)
if decoder == nil {
decoder, ok := value.(pgtype.BinaryDecoder)
if !ok {
decoder = &pgtype.GenericBinary{}
}
err := decoder.DecodeBinary(rows.connInfo, buf)