mirror of https://github.com/go-gorm/gorm.git
Find Field by db name also
This commit is contained in:
parent
3d20aafa40
commit
0b8c9f29a9
2
scope.go
2
scope.go
|
@ -273,7 +273,7 @@ func (scope *Scope) CombinedConditionSql() string {
|
||||||
|
|
||||||
func (scope *Scope) FieldByName(name string) (field *Field, ok bool) {
|
func (scope *Scope) FieldByName(name string) (field *Field, ok bool) {
|
||||||
for _, field := range scope.Fields() {
|
for _, field := range scope.Fields() {
|
||||||
if field.Name == name {
|
if field.Name == name || field.DBName == name {
|
||||||
return field, true
|
return field, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue