Use simplified pgtype ScanPlan
This commit is contained in:
@@ -111,7 +111,6 @@ type connRows struct {
|
||||
multiResultReader *pgconn.MultiResultReader
|
||||
|
||||
scanPlans []pgtype.ScanPlan
|
||||
dstValues []interface{}
|
||||
}
|
||||
|
||||
func (rows *connRows) FieldDescriptions() []pgproto3.FieldDescription {
|
||||
@@ -204,7 +203,12 @@ func (rows *connRows) Scan(dest ...interface{}) error {
|
||||
|
||||
if rows.scanPlans == nil {
|
||||
rows.scanPlans = make([]pgtype.ScanPlan, len(values))
|
||||
rows.dstValues = make([]interface{}, len(values))
|
||||
for i, dst := range dest {
|
||||
if dst == nil {
|
||||
continue
|
||||
}
|
||||
rows.scanPlans[i] = ci.PlanScan(fieldDescriptions[i].DataTypeOID, fieldDescriptions[i].Format, values[i], dest[i])
|
||||
}
|
||||
}
|
||||
|
||||
for i, dst := range dest {
|
||||
@@ -212,11 +216,6 @@ func (rows *connRows) Scan(dest ...interface{}) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if dst != rows.dstValues[i] {
|
||||
rows.scanPlans[i] = ci.PlanScan(fieldDescriptions[i].DataTypeOID, fieldDescriptions[i].Format, values[i], dest[i])
|
||||
rows.dstValues[i] = dst
|
||||
}
|
||||
|
||||
err := rows.scanPlans[i].Scan(ci, fieldDescriptions[i].DataTypeOID, fieldDescriptions[i].Format, values[i], dst)
|
||||
if err != nil {
|
||||
err = scanArgError{col: i, err: err}
|
||||
|
||||
Reference in New Issue
Block a user