mirror of https://github.com/go-gorm/gorm.git
Add dest value if current size equal zero
This commit is contained in:
parent
e953880d19
commit
9f533950a2
3
scan.go
3
scan.go
|
@ -225,7 +225,8 @@ func Scan(rows *sql.Rows, db *DB, mode ScanMode) {
|
|||
case reflect.Slice, reflect.Array:
|
||||
var elem reflect.Value
|
||||
|
||||
if !update && reflectValue.Len() != 0 {
|
||||
if !update || reflectValue.Len() == 0 {
|
||||
update = false
|
||||
db.Statement.ReflectValue.Set(reflect.MakeSlice(reflectValue.Type(), 0, 20))
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/google/uuid v1.3.0
|
||||
github.com/jinzhu/now v1.1.2
|
||||
github.com/lib/pq v1.10.3
|
||||
gorm.io/driver/mysql v1.1.2
|
||||
gorm.io/driver/mysql v1.1.3
|
||||
gorm.io/driver/postgres v1.2.1
|
||||
gorm.io/driver/sqlite v1.2.2
|
||||
gorm.io/driver/sqlserver v1.1.2
|
||||
|
|
Loading…
Reference in New Issue