Fix query with uninitialized map

This commit is contained in:
Jinzhu 2021-11-01 12:00:36 +08:00
parent 9f533950a2
commit 9635d25150
2 changed files with 4 additions and 1 deletions

View File

@ -130,6 +130,9 @@ func Scan(rows *sql.Rows, db *DB, mode ScanMode) {
mapValue, ok := dest.(map[string]interface{})
if !ok {
if v, ok := dest.(*map[string]interface{}); ok {
if *v == nil {
*v = map[string]interface{}{}
}
mapValue = *v
}
}

View File

@ -8,7 +8,7 @@ require (
github.com/lib/pq v1.10.3
gorm.io/driver/mysql v1.1.3
gorm.io/driver/postgres v1.2.1
gorm.io/driver/sqlite v1.2.2
gorm.io/driver/sqlite v1.2.3
gorm.io/driver/sqlserver v1.1.2
gorm.io/gorm v1.22.0
)