From a00b23e3069afb3278525bffa87ac5a78e26a150 Mon Sep 17 00:00:00 2001 From: Patrik Segedy Date: Thu, 14 Sep 2023 11:58:57 +0200 Subject: [PATCH] RHINENG-1835: use lowercase when translating struct field to column name --- base/database/query.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/base/database/query.go b/base/database/query.go index 39edabb28..0bbd8b086 100644 --- a/base/database/query.go +++ b/base/database/query.go @@ -4,12 +4,13 @@ import ( "app/base" "app/base/utils" "fmt" - "github.com/pkg/errors" "reflect" "regexp" "strconv" "strings" "time" + + "github.com/pkg/errors" ) type AttrParser func(string) (interface{}, error) @@ -91,7 +92,7 @@ func getQueryFromTags(v reflect.Type) (AttrMap, []AttrName, error) { res[k] = v } } else { - columnName := field.Name + columnName := strings.ToLower(field.Name) if expr, has := field.Tag.Lookup("gorm"); has { match := ColumnNameRe.FindStringSubmatch(expr) if len(match) > 0 {