Skip to content

Commit

Permalink
Merge pull request #92 from doug-martin/fix-reflect-val-assign
Browse files Browse the repository at this point in the history
v7.0.1
  • Loading branch information
doug-martin authored Jul 9, 2019
2 parents b25badd + 5cfb4d4 commit 4cc9fa7
Show file tree
Hide file tree
Showing 6 changed files with 1,148 additions and 183 deletions.
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v7.0.1

* Fix issue where structs with pointer fields where not set properly [#86](https://github.com/doug-martin/goqu/pull/86) and [#89](https://github.com/doug-martin/goqu/pull/89) - [@efureev](https://github.com/efureev)

## v7.0.0

**Linting**
Expand Down
10 changes: 7 additions & 3 deletions exec/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ func (q *scanner) ScanVals(i interface{}) (found bool, err error) {
func (q *scanner) scanIntoRecord(columns []string, cm util.ColumnMap) (record exp.Record, err error) {
scans := make([]interface{}, len(columns))
for i, col := range columns {
if data, ok := cm[col]; ok {
scans[i] = reflect.New(data.GoType).Interface()
} else {
data, ok := cm[col]
switch {
case !ok:
return record, unableToFindFieldError(col)
case util.IsPointer(data.GoType.Kind()):
scans[i] = reflect.New(data.GoType.Elem()).Interface()
default:
scans[i] = reflect.New(data.GoType).Interface()
}
}
if err := q.rows.Scan(scans...); err != nil {
Expand Down
Loading

0 comments on commit 4cc9fa7

Please sign in to comment.