本文整理汇总了Golang中github.com/pomack/thrift4go/lib/go/src/thrift.TMap.Len方法的典型用法代码示例。如果您正苦于以下问题:Golang TMap.Len方法的具体用法?Golang TMap.Len怎么用?Golang TMap.Len使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pomack/thrift4go/lib/go/src/thrift.TMap
的用法示例。
在下文中一共展示了TMap.Len方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: rowFromTMapColumns
func rowFromTMapColumns(key []byte, tm thrift.TMap) *SuperRow {
if tm == nil || tm.Len() <= 0 {
return nil
}
r := &SuperRow{Key: key}
for ele := range tm.Iter() {
//fmt.Printf("K: %s V: %+v %T\n", ele.Key(), ele.Value(), ele.Value())
tl := ele.Value().(thrift.TList)
for colI := range tl.Iter() {
var col *cassandra.ColumnOrSuperColumn = colI.(*cassandra.ColumnOrSuperColumn)
row := &Row{Key: col.SuperColumn.Name}
r.Rows = append(r.Rows, row)
//fmt.Printf("\tSCName: %s\n", col.SuperColumn.Name)
//fmt.Printf("Columns: %+v %T\n", col.SuperColumn.Columns, col.SuperColumn.Columns)
for colX := range col.SuperColumn.Columns.Iter() {
theRealCol := colX.(*cassandra.Column)
c := &Column{
Name: theRealCol.Name,
Value: theRealCol.Value,
Timestamp: theRealCol.Timestamp,
Ttl: theRealCol.Ttl,
}
row.Columns = append(row.Columns, c)
//fmt.Printf("\t\tcol: %s %s\n",theRealCol.Name, theRealCol.Value)
}
}
}
return r
}
示例2: rowsColumnCountFromTMap
func rowsColumnCountFromTMap(tm thrift.TMap) []*RowColumnCount {
if tm == nil || tm.Len() <= 0 {
return make([]*RowColumnCount, 0)
}
r := make([]*RowColumnCount, 0)
for rowI := range tm.Iter() {
key := keyFromTMap(rowI)
count := int((rowI.Value()).(int32))
if count > 0 {
r = append(r, &RowColumnCount{Key: key, Count: count})
}
}
return r
}
示例3: rowsFromTMap
func rowsFromTMap(tm thrift.TMap) []*Row {
if tm == nil || tm.Len() <= 0 {
return make([]*Row, 0)
}
r := make([]*Row, 0)
for rowI := range tm.Iter() {
key := keyFromTMap(rowI)
columns := (rowI.Value()).(thrift.TList)
row := rowFromTListColumns(key, columns)
if row != nil {
r = append(r, row)
}
}
return r
}