Skip to content

Commit

Permalink
optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
demoManito committed Mar 11, 2024
1 parent 5d68f56 commit 27318ac
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,7 @@ func Scan(rows Rows, db *DB, mode ScanMode) {
if !update || reflectValue.Len() == 0 {
update = false
if isArrayKind {
for i := 0; i < reflectValue.Len(); i++ {
reflectValue.Index(i).Set(reflect.Zero(reflectValue.Index(i).Type()))
}
db.Statement.ReflectValue.Set(reflect.Zero(reflectValue.Type()))
} else {
// if the slice cap is externally initialized, the externally initialized slice is directly used here
if reflectValue.Cap() == 0 {
Expand Down

0 comments on commit 27318ac

Please sign in to comment.