2
0

Use pgtype.NewValue instead of reflect for Values()

This is both cleaner and necessary for pgtype.TypeValue types.
This commit is contained in:
Jack Christensen
2020-05-30 13:32:15 -05:00
parent 8dee3382f7
commit 4b95a747d7
3 changed files with 5 additions and 3 deletions
+1 -2
View File
@@ -3,7 +3,6 @@ package pgx
import (
"context"
"fmt"
"reflect"
"time"
errors "golang.org/x/xerrors"
@@ -244,7 +243,7 @@ func (rows *connRows) Values() ([]interface{}, error) {
}
if dt, ok := rows.connInfo.DataTypeForOID(fd.DataTypeOID); ok {
value := reflect.New(reflect.ValueOf(dt.Value).Elem().Type()).Interface().(pgtype.Value)
value := pgtype.NewValue(dt.Value)
switch fd.Format {
case TextFormatCode: