Select all fields in sql queries avoiding SELECT * FROM

This commit is contained in:
Luis Gómez 2020-11-08 17:53:56 -05:00
parent 72859db7a8
commit 74bd4abbd2

View File

@ -75,7 +75,7 @@ func BuildQuerySQL(db *gorm.DB) {
smallerStruct := false
switch db.Statement.ReflectValue.Kind() {
case reflect.Struct:
smallerStruct = db.Statement.ReflectValue.Type() != db.Statement.Schema.ModelType
smallerStruct = true
case reflect.Slice:
smallerStruct = db.Statement.ReflectValue.Type().Elem() != db.Statement.Schema.ModelType
}