From 4843af1f94e08ec1824fc945fceb033a7fd18bac Mon Sep 17 00:00:00 2001 From: fcodetop <30854801+fcodetop@users.noreply.github.com> Date: Wed, 27 Nov 2019 16:23:37 +0800 Subject: [PATCH] map the column of the alias name to the struct Fixed issues#2315 --- scope.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope.go b/scope.go index eb7525b8..04525238 100644 --- a/scope.go +++ b/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 {