Skip to content

Commit

Permalink
RHINENG-1835: use lowercase when translating struct field to column name
Browse files Browse the repository at this point in the history
  • Loading branch information
psegedy committed Sep 14, 2023
1 parent 490048e commit a00b23e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/database/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a00b23e

Please sign in to comment.