bug fix:修复可能的panic状态;增加更多功能
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package scanutil
|
||||
|
||||
// CloneScannedValue copies driver-scanned values that may be reused by driver.
|
||||
// []byte is deep-copied; other types are returned as-is.
|
||||
func CloneScannedValue(val interface{}) interface{} {
|
||||
if b, ok := val.([]byte); ok {
|
||||
copied := make([]byte, len(b))
|
||||
copy(copied, b)
|
||||
return copied
|
||||
}
|
||||
return val
|
||||
}
|
||||
Reference in New Issue
Block a user