Skip to content

Commit

Permalink
added helper function RowData() for getting back a map of column name…
Browse files Browse the repository at this point in the history
… and pointer to empty type
  • Loading branch information
cwndrws committed Feb 10, 2014
1 parent 720cebc commit 569075a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ func goType(t *TypeInfo) reflect.Type {

func dereference(i interface{}) interface{} {
return reflect.Indirect(reflect.ValueOf(i)).Interface()
}

func (iter *Iter) RowData() (map[string]interface{}, error) {
if iter.err != nil {
return nil, iter.err
}
rowData := make(map[string]interface{})
for _, column := range iter.Columns() {
rowData[column.Name] = column.TypeInfo.New()
}
return rowData, nil
}

// SliceMap is a helper function to make the API easier to use
Expand Down

0 comments on commit 569075a

Please sign in to comment.