diff --git a/scan.go b/scan.go index 119049c6..2d0c8fc6 100644 --- a/scan.go +++ b/scan.go @@ -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 } } diff --git a/tests/go.mod b/tests/go.mod index 52781a8b..8ced0b2f 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -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 )