當前位置: 首頁>>代碼示例>>Golang>>正文


Golang TList.Push方法代碼示例

本文整理匯總了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
}
開發者ID:ngmoco,項目名稱:gossie,代碼行數:26,代碼來源:reader.go

示例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
}
開發者ID:carloscm,項目名稱:gossie,代碼行數:21,代碼來源:writer.go


注:本文中的github.com/pomack/thrift4go/lib/go/src/thrift.TList.Push方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。