本文整理汇总了Golang中github.com/pomack/thrift4go/lib/go/src/thrift.TList类的典型用法代码示例。如果您正苦于以下问题:Golang TList类的具体用法?Golang TList怎么用?Golang TList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TList类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: rowFromTListColumns
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
}
开发者ID:rcrowley,项目名称:gossie,代码行数:26,代码来源:reader.go
示例2: SuperGet
func (r *reader) SuperGet(key []byte) (*SuperRow, error) {
if r.cf == "" {
return nil, errors.New("No column family specified")
}
cp := r.buildColumnParent()
sp := r.buildPredicate()
var ret thrift.TMap
var keys thrift.TList = thrift.NewTList(thrift.BINARY, 0) // size appears to be ignored in the thrift lib
keys.Push(key)
err := r.pool.run(func(c *connection) (*cassandra.InvalidRequestException, *cassandra.UnavailableException, *cassandra.TimedOutException, error) {
var ire *cassandra.InvalidRequestException
var ue *cassandra.UnavailableException
var te *cassandra.TimedOutException
var err error
ret, ire, ue, te, err = c.client.MultigetSlice(keys, cp, sp, cassandra.ConsistencyLevel(r.consistencyLevel))
return ire, ue, te, err
})
if err != nil {
return nil, err
}
return rowFromTMapColumns(key, ret), nil
}
开发者ID:ngmoco,项目名称:gossie,代码行数:26,代码来源:reader.go
示例3: rowsFromTListKeySlice
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
}
开发者ID:rcrowley,项目名称:gossie,代码行数:15,代码来源:reader.go
示例4: addWriter
func (w *writer) addWriter(cf string, key []byte) *cassandra.Mutation {
tm := cassandra.NewMutation()
var cfMuts thrift.TMap
im, exists := w.writers.Get(key)
if !exists {
cfMuts = thrift.NewTMap(thrift.STRING, thrift.LIST, 1)
w.writers.Set(key, cfMuts)
} else {
cfMuts = im.(thrift.TMap)
}
var mutList thrift.TList
im, exists = cfMuts.Get(cf)
if !exists {
mutList = thrift.NewTList(thrift.STRUCT, 1)
cfMuts.Set(cf, mutList)
} else {
mutList = im.(thrift.TList)
}
mutList.Push(tm)
return tm
}
开发者ID:carloscm,项目名称:gossie,代码行数:21,代码来源:writer.go
注:本文中的github.com/pomack/thrift4go/lib/go/src/thrift.TList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论