From 569075a4f37c95b44876169d25f711f09cbaa133 Mon Sep 17 00:00:00 2001 From: cwandrews Date: Mon, 10 Feb 2014 09:31:29 -0500 Subject: [PATCH] added helper function RowData() for getting back a map of column name and pointer to empty type --- helpers.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/helpers.go b/helpers.go index fa366080f..8a16a06f9 100644 --- a/helpers.go +++ b/helpers.go @@ -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