From 74bd4abbd2335a4a10647e1b37df4c89a66b516a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20G=C3=B3mez?= Date: Sun, 8 Nov 2020 17:53:56 -0500 Subject: [PATCH] Select all fields in sql queries avoiding SELECT * FROM --- callbacks/query.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/callbacks/query.go b/callbacks/query.go index d660528c..68c322c1 100644 --- a/callbacks/query.go +++ b/callbacks/query.go @@ -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 }