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


Golang bson.EncodeUint64函數代碼示例

本文整理匯總了Golang中github.com/youtube/vitess/go/bson.EncodeUint64函數的典型用法代碼示例。如果您正苦於以下問題:Golang EncodeUint64函數的具體用法?Golang EncodeUint64怎麽用?Golang EncodeUint64使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EncodeUint64函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: MarshalBson

// MarshalBson bson-encodes QueryResult.
func (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []Field
	{
		bson.EncodePrefix(buf, bson.Array, "Fields")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range queryResult.Fields {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeUint64(buf, "RowsAffected", queryResult.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", queryResult.InsertId)
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "Rows")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryResult.Rows {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
開發者ID:chinna1986,項目名稱:vitess,代碼行數:36,代碼來源:query_result_bson.go

示例2: MarshalBson

func (qr *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	EncodeFieldsBson(qr.Fields, "Fields", buf)
	bson.EncodeUint64(buf, "RowsAffected", qr.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", qr.InsertId)
	EncodeRowsBson(qr.Rows, "Rows", buf)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:rudyLi,項目名稱:vitess,代碼行數:12,代碼來源:bson.go

示例3: MarshalBson

func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Long, "TransactionId")
	bson.EncodeUint64(buf, uint64(session.TransactionId))

	bson.EncodePrefix(buf, bson.Long, "ConnectionId")
	bson.EncodeUint64(buf, uint64(session.ConnectionId))

	bson.EncodePrefix(buf, bson.Long, "SessionId")
	bson.EncodeUint64(buf, uint64(session.SessionId))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:15,代碼來源:bson.go

示例4: MarshalBson

func (pos *BinlogPosition) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Object, "Position")
	pos.Position.MarshalBson(buf)

	bson.EncodePrefix(buf, bson.Long, "Timestamp")
	bson.EncodeUint64(buf, uint64(pos.Timestamp))

	bson.EncodePrefix(buf, bson.Ulong, "Xid")
	bson.EncodeUint64(buf, pos.Xid)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:15,代碼來源:binlog.go

示例5: MarshalBson

// MarshalBson bson-encodes QueryResult.
func (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []*query.Field
	{
		bson.EncodePrefix(buf, bson.Array, "Fields")
		lenWriter := bson.NewLenWriter(buf)
		var f BSONField
		for _i, _v1 := range queryResult.Fields {
			// *query.Field
			// This part was manually changed.
			f.Name = _v1.Name
			f.Type, f.Flags = sqltypes.TypeToMySQL(_v1.Type)
			bson.EncodeOptionalPrefix(buf, bson.Object, bson.Itoa(_i))
			bson.MarshalToBuffer(buf, &f)
		}
		lenWriter.Close()
	}
	bson.EncodeUint64(buf, "RowsAffected", queryResult.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", queryResult.InsertId)
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "Rows")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryResult.Rows {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}
	// *RPCError
	if queryResult.Err == nil {
		bson.EncodePrefix(buf, bson.Null, "Err")
	} else {
		(*queryResult.Err).MarshalBson(buf, "Err")
	}

	lenWriter.Close()
}
開發者ID:tjyang,項目名稱:vitess,代碼行數:48,代碼來源:query_result_bson.go

示例6: encodeReplCoordinates

func (pos *BinlogPosition) encodeReplCoordinates(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "RelayFilename")
	bson.EncodeString(buf, pos.Position.RelayFilename)

	bson.EncodePrefix(buf, bson.Ulong, "RelayPosition")
	bson.EncodeUint64(buf, pos.Position.RelayPosition)

	bson.EncodePrefix(buf, bson.Binary, "MasterFilename")
	bson.EncodeString(buf, pos.Position.MasterFilename)

	bson.EncodePrefix(buf, bson.Ulong, "MasterPosition")
	bson.EncodeUint64(buf, pos.Position.MasterPosition)
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:shrutip,項目名稱:vitess,代碼行數:17,代碼來源:binlog_parser.go

示例7: MarshalBson

// MarshalBson marshals request to the given writer with optional prefix
func (req *RequestBson) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "ServiceMethod", req.ServiceMethod)
	bson.EncodeUint64(buf, "Seq", req.Seq)

	lenWriter.Close()
}
開發者ID:littleyang,項目名稱:vitess,代碼行數:10,代碼來源:custom_codecs.go

示例8: MarshalBson

func (qr *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Array, "Fields")
	encodeFieldsBson(qr.Fields, buf)

	bson.EncodePrefix(buf, bson.Long, "RowsAffected")
	bson.EncodeUint64(buf, uint64(qr.RowsAffected))

	bson.EncodePrefix(buf, bson.Long, "InsertId")
	bson.EncodeUint64(buf, uint64(qr.InsertId))

	bson.EncodePrefix(buf, bson.Array, "Rows")
	encodeRowsBson(qr.Rows, buf)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:18,代碼來源:bson.go

示例9: MarshalBson

// MarshalBson bson-encodes QueryResult.
func (queryResult *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	// []mproto.Field
	{
		bson.EncodePrefix(buf, bson.Array, "Fields")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range queryResult.Fields {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeUint64(buf, "RowsAffected", queryResult.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", queryResult.InsertId)
	// [][]sqltypes.Value
	{
		bson.EncodePrefix(buf, bson.Array, "Rows")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryResult.Rows {
			// []sqltypes.Value
			{
				bson.EncodePrefix(buf, bson.Array, bson.Itoa(_i))
				lenWriter := bson.NewLenWriter(buf)
				for _i, _v3 := range _v2 {
					_v3.MarshalBson(buf, bson.Itoa(_i))
				}
				lenWriter.Close()
			}
		}
		lenWriter.Close()
	}
	// *Session
	if queryResult.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*queryResult.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeString(buf, "Error", queryResult.Error)

	lenWriter.Close()
}
開發者ID:kingpro,項目名稱:vitess,代碼行數:43,代碼來源:query_result_bson.go

示例10: MarshalBson

func (resp *ResponseBson) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodeString(buf, "ServiceMethod", resp.ServiceMethod)
	bson.EncodeUint64(buf, "Seq", resp.Seq)
	bson.EncodeString(buf, "Error", resp.Error)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:rudyLi,項目名稱:vitess,代碼行數:11,代碼來源:custom_codecs.go

示例11: MarshalBson

// MarshalBson marshals QueryResult into buf.
func (qr *QueryResult) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
	bson.EncodeOptionalPrefix(buf, bson.Object, key)
	lenWriter := bson.NewLenWriter(buf)

	mproto.EncodeFieldsBson(qr.Fields, "Fields", buf)
	bson.EncodeUint64(buf, "RowsAffected", qr.RowsAffected)
	bson.EncodeUint64(buf, "InsertId", qr.InsertId)
	mproto.EncodeRowsBson(qr.Rows, "Rows", buf)

	if qr.Session != nil {
		qr.Session.MarshalBson(buf, "Session")
	}

	if qr.Error != "" {
		bson.EncodeString(buf, "Error", qr.Error)
	}

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:rudyLi,項目名稱:vitess,代碼行數:21,代碼來源:vtgate_proto.go

示例12: MarshalFieldBson

func MarshalFieldBson(field Field, buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Name")
	bson.EncodeString(buf, field.Name)

	bson.EncodePrefix(buf, bson.Long, "Type")
	bson.EncodeUint64(buf, uint64(field.Type))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:12,代碼來源:bson.go

示例13: MarshalBson

func (req *RequestBson) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "ServiceMethod")
	bson.EncodeString(buf, req.ServiceMethod)

	bson.EncodePrefix(buf, bson.Long, "Seq")
	bson.EncodeUint64(buf, uint64(req.Seq))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:johnvilsack,項目名稱:golang-stuff,代碼行數:12,代碼來源:custom_codecs.go

示例14: MarshalBson

func (zkStat *ZkStat) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Long, "Czxid")
	bson.EncodeUint64(buf, uint64(zkStat.czxid))

	bson.EncodePrefix(buf, bson.Long, "Mzxid")
	bson.EncodeUint64(buf, uint64(zkStat.mzxid))

	bson.EncodePrefix(buf, bson.Datetime, "CTime")
	bson.EncodeTime(buf, zkStat.cTime)

	bson.EncodePrefix(buf, bson.Datetime, "MTime")
	bson.EncodeTime(buf, zkStat.mTime)

	bson.EncodePrefix(buf, bson.Int, "Version")
	bson.EncodeUint32(buf, uint32(zkStat.version))

	bson.EncodePrefix(buf, bson.Int, "CVersion")
	bson.EncodeUint32(buf, uint32(zkStat.cVersion))

	bson.EncodePrefix(buf, bson.Int, "AVersion")
	bson.EncodeUint32(buf, uint32(zkStat.aVersion))

	bson.EncodePrefix(buf, bson.Long, "EphemeralOwner")
	bson.EncodeUint64(buf, uint64(zkStat.ephemeralOwner))

	bson.EncodePrefix(buf, bson.Int, "DataLength")
	bson.EncodeUint32(buf, uint32(zkStat.dataLength))

	bson.EncodePrefix(buf, bson.Int, "NumChildren")
	bson.EncodeUint32(buf, uint32(zkStat.numChildren))

	bson.EncodePrefix(buf, bson.Long, "Pzxid")
	bson.EncodeUint64(buf, uint64(zkStat.pzxid))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:rrudduck,項目名稱:golang-stuff,代碼行數:39,代碼來源:zkocc_bson.go

示例15: MarshalBson

func (bqs *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Array, "Queries")
	encodeQueriesBson(bqs.Queries, buf)

	bson.EncodePrefix(buf, bson.Long, "SessionId")
	bson.EncodeUint64(buf, uint64(bqs.SessionId))

	bson.EncodePrefix(buf, bson.Binary, "Keyspace")
	bson.EncodeString(buf, bqs.Keyspace)

	bson.EncodeStringArray(buf, "Shards", bqs.Shards)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
開發者ID:ZhuoRoger,項目名稱:vitess,代碼行數:17,代碼來源:vtgate_proto.go


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