From f39966fb2c5e6eef06346626bdcb83203db397b6 Mon Sep 17 00:00:00 2001 From: SystemGlitch Date: Thu, 18 Apr 2024 12:24:06 +0200 Subject: [PATCH] Fix SELECT 1 leads to attempt of scanning []int64 instead of struct --- settings.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings.go b/settings.go index 5ca7848..268b09b 100644 --- a/settings.go +++ b/settings.go @@ -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)