13 lines
326 B
Go
13 lines
326 B
Go
|
|
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
|
||
|
|
}
|