• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang bson.EncodePrefix函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/youtube/vitess/go/bson.EncodePrefix函数的典型用法代码示例。如果您正苦于以下问题:Golang EncodePrefix函数的具体用法?Golang EncodePrefix怎么用?Golang EncodePrefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了EncodePrefix函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: MarshalBson

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

	bson.EncodeString(buf, "Sql", queryShard.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range queryShard.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", queryShard.Keyspace)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range queryShard.Shards {
			bson.EncodeString(buf, bson.Itoa(_i), _v2)
		}
		lenWriter.Close()
	}
	queryShard.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if queryShard.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*queryShard.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeBool(buf, "NotInTransaction", queryShard.NotInTransaction)

	lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:36,代码来源:query_shard_bson.go


示例2: MarshalBson

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

	bson.EncodeString(buf, "Sql", keyspaceIdQuery.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range keyspaceIdQuery.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", keyspaceIdQuery.Keyspace)
	// []kproto.KeyspaceId
	{
		bson.EncodePrefix(buf, bson.Array, "KeyspaceIds")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range keyspaceIdQuery.KeyspaceIds {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	keyspaceIdQuery.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if keyspaceIdQuery.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*keyspaceIdQuery.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
开发者ID:chinna1986,项目名称:vitess,代码行数:35,代码来源:keyspace_id_query_bson.go


示例3: MarshalBson

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

	// []tproto.BoundQuery
	{
		bson.EncodePrefix(buf, bson.Array, "Queries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range batchQueryShard.Queries {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", batchQueryShard.Keyspace)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range batchQueryShard.Shards {
			bson.EncodeString(buf, bson.Itoa(_i), _v2)
		}
		lenWriter.Close()
	}
	batchQueryShard.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if batchQueryShard.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*batchQueryShard.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeBool(buf, "NotInTransaction", batchQueryShard.NotInTransaction)

	lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:35,代码来源:batch_query_shard_bson.go


示例4: MarshalBson

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

	bson.EncodeString(buf, "Sql", boundShardQuery.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range boundShardQuery.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", boundShardQuery.Keyspace)
	// []string
	{
		bson.EncodePrefix(buf, bson.Array, "Shards")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range boundShardQuery.Shards {
			bson.EncodeString(buf, bson.Itoa(_i), _v2)
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:28,代码来源:bound_shard_query_bson.go


示例5: MarshalBson

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

	bson.EncodeString(buf, "Sql", entityIdsQuery.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range entityIdsQuery.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", entityIdsQuery.Keyspace)
	bson.EncodeString(buf, "EntityColumnName", entityIdsQuery.EntityColumnName)
	// map[string]kproto.KeyspaceId
	{
		bson.EncodePrefix(buf, bson.Object, "EntityKeyspaceIdMap")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v2 := range entityIdsQuery.EntityKeyspaceIdMap {
			_v2.MarshalBson(buf, _k)
		}
		lenWriter.Close()
	}
	entityIdsQuery.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if entityIdsQuery.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*entityIdsQuery.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
开发者ID:nosix-me,项目名称:vitess,代码行数:36,代码来源:entity_ids_query_bson.go


示例6: MarshalBson

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

	// map[TabletType]*KeyspacePartition
	{
		bson.EncodePrefix(buf, bson.Object, "Partitions")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range srvKeyspace.Partitions {
			// *KeyspacePartition
			if _v1 == nil {
				bson.EncodePrefix(buf, bson.Null, string(_k))
			} else {
				(*_v1).MarshalBson(buf, string(_k))
			}
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "ShardingColumnName", srvKeyspace.ShardingColumnName)
	srvKeyspace.ShardingColumnType.MarshalBson(buf, "ShardingColumnType")
	// map[TabletType]string
	{
		bson.EncodePrefix(buf, bson.Object, "ServedFrom")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v2 := range srvKeyspace.ServedFrom {
			bson.EncodeString(buf, string(_k), _v2)
		}
		lenWriter.Close()
	}
	bson.EncodeInt32(buf, "SplitShardCount", srvKeyspace.SplitShardCount)

	lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:34,代码来源:srvkeyspace_bson.go


示例7: MarshalBson

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

	bson.EncodeString(buf, "Name", srvShard.Name)
	srvShard.KeyRange.MarshalBson(buf, "KeyRange")
	// []TabletType
	{
		bson.EncodePrefix(buf, bson.Array, "ServedTypes")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range srvShard.ServedTypes {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "MasterCell", srvShard.MasterCell)
	// []TabletType
	{
		bson.EncodePrefix(buf, bson.Array, "TabletTypes")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range srvShard.TabletTypes {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}

	lenWriter.Close()
}
开发者ID:chinna1986,项目名称:vitess,代码行数:29,代码来源:srvshard_bson.go


示例8: MarshalBson

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

	// *tproto.CallerID
	if batchQueryShard.CallerID == nil {
		bson.EncodePrefix(buf, bson.Null, "CallerID")
	} else {
		(*batchQueryShard.CallerID).MarshalBson(buf, "CallerID")
	}
	// []BoundShardQuery
	{
		bson.EncodePrefix(buf, bson.Array, "Queries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range batchQueryShard.Queries {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	batchQueryShard.TabletType.MarshalBson(buf, "TabletType")
	bson.EncodeBool(buf, "AsTransaction", batchQueryShard.AsTransaction)
	// *Session
	if batchQueryShard.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*batchQueryShard.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:31,代码来源:batch_query_shard_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.QueryResult
	if queryResult.Result == nil {
		bson.EncodePrefix(buf, bson.Null, "Result")
	} else {
		(*queryResult.Result).MarshalBson(buf, "Result")
	}
	// *Session
	if queryResult.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*queryResult.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeString(buf, "Error", queryResult.Error)
	// *mproto.RPCError
	if queryResult.Err == nil {
		bson.EncodePrefix(buf, bson.Null, "Err")
	} else {
		(*queryResult.Err).MarshalBson(buf, "Err")
	}

	lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:27,代码来源:query_result_bson.go


示例10: 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


示例11: MarshalBson

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

	// *tproto.CallerID
	if query.CallerID == nil {
		bson.EncodePrefix(buf, bson.Null, "CallerID")
	} else {
		(*query.CallerID).MarshalBson(buf, "CallerID")
	}
	bson.EncodeString(buf, "Sql", query.Sql)
	// map[string]interface{}
	{
		bson.EncodePrefix(buf, bson.Object, "BindVariables")
		lenWriter := bson.NewLenWriter(buf)
		for _k, _v1 := range query.BindVariables {
			bson.EncodeInterface(buf, _k, _v1)
		}
		lenWriter.Close()
	}
	query.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if query.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*query.Session).MarshalBson(buf, "Session")
	}
	bson.EncodeBool(buf, "NotInTransaction", query.NotInTransaction)

	lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:32,代码来源:query_bson.go


示例12: MarshalBson

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

	// []tproto.BoundQuery
	{
		bson.EncodePrefix(buf, bson.Array, "Queries")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v1 := range keyspaceIdBatchQuery.Queries {
			_v1.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	bson.EncodeString(buf, "Keyspace", keyspaceIdBatchQuery.Keyspace)
	// []kproto.KeyspaceId
	{
		bson.EncodePrefix(buf, bson.Array, "KeyspaceIds")
		lenWriter := bson.NewLenWriter(buf)
		for _i, _v2 := range keyspaceIdBatchQuery.KeyspaceIds {
			_v2.MarshalBson(buf, bson.Itoa(_i))
		}
		lenWriter.Close()
	}
	keyspaceIdBatchQuery.TabletType.MarshalBson(buf, "TabletType")
	// *Session
	if keyspaceIdBatchQuery.Session == nil {
		bson.EncodePrefix(buf, bson.Null, "Session")
	} else {
		(*keyspaceIdBatchQuery.Session).MarshalBson(buf, "Session")
	}

	lenWriter.Close()
}
开发者ID:chinna1986,项目名称:vitess,代码行数:34,代码来源:keyspace_id_batch_query_bson.go


示例13: EncodeQueriesBson

func EncodeQueriesBson(queries []BoundQuery, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range queries {
		bson.EncodePrefix(buf, bson.Object, bson.Itoa(i))
		v.MarshalBson(buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
开发者ID:rjammala,项目名称:vitess,代码行数:10,代码来源:bson.go


示例14: EncodeResultsBson

func EncodeResultsBson(results []mproto.QueryResult, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range results {
		bson.EncodePrefix(buf, bson.Object, bson.Itoa(i))
		v.MarshalBson(buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
开发者ID:rjammala,项目名称:vitess,代码行数:10,代码来源:bson.go


示例15: MarshalStatementsBson

func MarshalStatementsBson(buf *bytes2.ChunkedWriter, key string, statements []Statement) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range statements {
		bson.EncodePrefix(buf, bson.Object, bson.Itoa(i))
		v.MarshalBson(buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
开发者ID:rjammala,项目名称:vitess,代码行数:10,代码来源:binlog_transaction.go


示例16: encodeShardSessionsBson

func encodeShardSessionsBson(shardSessions []*ShardSession, key string, buf *bytes2.ChunkedWriter) {
	bson.EncodePrefix(buf, bson.Array, key)
	lenWriter := bson.NewLenWriter(buf)
	for i, v := range shardSessions {
		bson.EncodePrefix(buf, bson.Object, bson.Itoa(i))
		v.MarshalBson(buf)
	}
	buf.WriteByte(0)
	lenWriter.RecordLen()
}
开发者ID:rjammala,项目名称:vitess,代码行数:10,代码来源:vtgate_proto.go


示例17: MarshalBson

func (kr *KeyRange) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Start")
	bson.EncodeString(buf, string(kr.Start))

	bson.EncodePrefix(buf, bson.Binary, "End")
	bson.EncodeString(buf, string(kr.End))

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
开发者ID:CERN-Stage-3,项目名称:vitess,代码行数:12,代码来源:key.go


示例18: 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


示例19: MarshalBson

func (bdq *BoundQuery) MarshalBson(buf *bytes2.ChunkedWriter) {
	lenWriter := bson.NewLenWriter(buf)

	bson.EncodePrefix(buf, bson.Binary, "Sql")
	bson.EncodeString(buf, bdq.Sql)

	bson.EncodePrefix(buf, bson.Object, "BindVariables")
	vproto.EncodeBindVariablesBson(buf, bdq.BindVariables)

	buf.WriteByte(0)
	lenWriter.RecordLen()
}
开发者ID:ZhuoRoger,项目名称:vitess,代码行数:12,代码来源:vtgate_proto.go


示例20: 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



注:本文中的github.com/youtube/vitess/go/bson.EncodePrefix函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang bson.EncodeString函数代码示例发布时间:2022-05-28
下一篇:
Golang bson.EncodeOptionalPrefix函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap