本文整理汇总了Golang中github.com/pomack/thrift4go/lib/go/src/thrift.TList.Push方法的典型用法代码示例。如果您正苦于以下问题:Golang TList.Push方法的具体用法?Golang TList.Push怎么用?Golang TList.Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pomack/thrift4go/lib/go/src/thrift.TList
的用法示例。
在下文中一共展示了TList.Push方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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
}
示例2: 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
}