Skip to content

Commit

Permalink
Fix SELECT 1 leads to attempt of scanning []int64 instead of struct
Browse files Browse the repository at this point in the history
  • Loading branch information
System-Glitch committed Apr 18, 2024
1 parent ee028ce commit f39966f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ func selectScope(table string, fields []*schema.Field, override bool) func(*gorm

var fieldsWithTableName []string
if len(fields) == 0 {
fieldsWithTableName = []string{"1"}
// Use two filler values so Gorm doesn't attempt to Scan into a []int64
fieldsWithTableName = []string{"1", "2"}
} else {
fieldsWithTableName = make([]string, 0, len(fields))
tableName := tx.Statement.Quote(table)
Expand Down

0 comments on commit f39966f

Please sign in to comment.