retrieving gorm object support pointer (#4006)

This commit is contained in:
Ben 2021-01-27 11:50:15 +08:00 committed by GitHub
parent 81aa949105
commit cc61202fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -191,7 +191,7 @@ func Scan(rows *sql.Rows, db *DB, initialized bool) {
db.Statement.ReflectValue.Set(reflect.Append(db.Statement.ReflectValue, elem.Elem())) db.Statement.ReflectValue.Set(reflect.Append(db.Statement.ReflectValue, elem.Elem()))
} }
} }
case reflect.Struct: case reflect.Struct, reflect.Ptr:
if db.Statement.ReflectValue.Type() != Schema.ModelType { if db.Statement.ReflectValue.Type() != Schema.ModelType {
Schema, _ = schema.Parse(db.Statement.Dest, db.cacheStore, db.NamingStrategy) Schema, _ = schema.Parse(db.Statement.Dest, db.cacheStore, db.NamingStrategy)
} }