Support upcase column names

This commit is contained in:
Jinzhu 2014-07-04 08:19:11 +08:00
parent 29ac192090
commit a9ac3e10a7
1 changed files with 2 additions and 1 deletions

View File

@ -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 {