optimization
This commit is contained in:
parent
5d68f566d3
commit
27318ac628
4
scan.go
4
scan.go
@ -275,9 +275,7 @@ func Scan(rows Rows, db *DB, mode ScanMode) {
|
|||||||
if !update || reflectValue.Len() == 0 {
|
if !update || reflectValue.Len() == 0 {
|
||||||
update = false
|
update = false
|
||||||
if isArrayKind {
|
if isArrayKind {
|
||||||
for i := 0; i < reflectValue.Len(); i++ {
|
db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type()))
|
||||||
reflectValue.Index(i).Set(reflect.Zero(reflectValue.Index(i).Type()))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// if the slice cap is externally initialized, the externally initialized slice is directly used here
|
// if the slice cap is externally initialized, the externally initialized slice is directly used here
|
||||||
if reflectValue.Cap() == 0 {
|
if reflectValue.Cap() == 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user