func rowFromTListColumns(key []byte, tl thrift.TList) *Row { if tl == nil || tl.Len() <= 0 { return nil } r := &Row{Key: key} for colI := range tl.Iter() { var col *cassandra.ColumnOrSuperColumn = colI.(*cassandra.ColumnOrSuperColumn) if col.Column != nil { c := &Column{ Name: col.Column.Name, Value: col.Column.Value, Timestamp: col.Column.Timestamp, Ttl: col.Column.Ttl, } r.Columns = append(r.Columns, c) } else if col.CounterColumn != nil { v, _ := Marshal(col.CounterColumn.Value, LongType) c := &Column{ Name: col.CounterColumn.Name, Value: v, } r.Columns = append(r.Columns, c) } } return r }
func rowsFromTListKeySlice(tl thrift.TList) []*Row { if tl == nil || tl.Len() <= 0 { return make([]*Row, 0) } r := make([]*Row, 0) for keySliceI := range tl.Iter() { keySlice := keySliceI.(*cassandra.KeySlice) key := keySlice.Key row := rowFromTListColumns(key, keySlice.Columns) if row != nil { r = append(r, row) } } return r }