forked from mirror/gorm
Support upcase column names
This commit is contained in:
parent
29ac192090
commit
a9ac3e10a7
|
@ -2,6 +2,7 @@ package gorm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ func Query(scope *Scope) {
|
||||||
columns, _ := rows.Columns()
|
columns, _ := rows.Columns()
|
||||||
var values []interface{}
|
var values []interface{}
|
||||||
for _, value := range columns {
|
for _, value := range columns {
|
||||||
field := elem.FieldByName(snakeToUpperCamel(value))
|
field := elem.FieldByName(snakeToUpperCamel(strings.ToLower(value)))
|
||||||
if field.IsValid() {
|
if field.IsValid() {
|
||||||
values = append(values, field.Addr().Interface())
|
values = append(values, field.Addr().Interface())
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue