map the column of the alias name to the struct
Fixed issues#2315
This commit is contained in:
parent
59408390c2
commit
4843af1f94
2
scope.go
2
scope.go
@ -493,7 +493,7 @@ func (scope *Scope) scan(rows *sql.Rows, columns []string, fields []*Field) {
|
||||
}
|
||||
|
||||
for fieldIndex, field := range selectFields {
|
||||
if field.DBName == column {
|
||||
if field.DBName == column || field.Name == column{
|
||||
if field.Field.Kind() == reflect.Ptr {
|
||||
values[index] = field.Field.Addr().Interface()
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user