Browse Source

fixed rowMap to copy slices instead of pass them in

Charlie Andrews 11 years ago
parent
commit
318248a7ce
1 changed files with 8 additions and 1 deletions
  1. 8 1
      helpers.go

+ 8 - 1
helpers.go

@@ -103,7 +103,14 @@ func getApacheCassandraType(class string) Type {
 
 func (r *RowData) rowMap(m map[string]interface{}) {
 	for i, column := range r.Columns {
-		m[column] = dereference(r.Values[i])
+		val := dereference(r.Values[i])
+		if valVal := reflect.ValueOf(val); valVal.Kind() == reflect.Slice {
+			valCopy := reflect.MakeSlice(valVal.Type(), valVal.Len(), valVal.Cap())
+			reflect.Copy(valCopy, valVal)
+			m[column] = valCopy.Interface()
+		} else {
+			m[column] = val
+		}
 	}
 }