Try wrapping scan target before sql.Scanner
This allows wrappers to directly avoid the slow sql.Scanner interface.
This commit is contained in:
+10
-8
@@ -906,14 +906,6 @@ func (ci *ConnInfo) PlanScan(oid uint32, formatCode int16, target interface{}) S
|
|||||||
if plan := dt.Codec.PlanScan(ci, oid, formatCode, target, false); plan != nil {
|
if plan := dt.Codec.PlanScan(ci, oid, formatCode, target, false); plan != nil {
|
||||||
return plan
|
return plan
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := target.(*interface{}); ok {
|
|
||||||
return &pointerEmptyInterfaceScanPlan{codec: dt.Codec, ci: ci, oid: oid, formatCode: formatCode}
|
|
||||||
}
|
|
||||||
|
|
||||||
if _, ok := target.(sql.Scanner); ok {
|
|
||||||
return &scanPlanCodecSQLScanner{c: dt.Codec, ci: ci, oid: oid, formatCode: formatCode}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range ci.TryWrapScanPlanFuncs {
|
for _, f := range ci.TryWrapScanPlanFuncs {
|
||||||
@@ -927,6 +919,16 @@ func (ci *ConnInfo) PlanScan(oid uint32, formatCode int16, target interface{}) S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dt != nil {
|
||||||
|
if _, ok := target.(*interface{}); ok {
|
||||||
|
return &pointerEmptyInterfaceScanPlan{codec: dt.Codec, ci: ci, oid: oid, formatCode: formatCode}
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := target.(sql.Scanner); ok {
|
||||||
|
return &scanPlanCodecSQLScanner{c: dt.Codec, ci: ci, oid: oid, formatCode: formatCode}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := target.(sql.Scanner); ok {
|
if _, ok := target.(sql.Scanner); ok {
|
||||||
return &scanPlanSQLScanner{formatCode: formatCode}
|
return &scanPlanSQLScanner{formatCode: formatCode}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user