本文整理汇总了Golang中github.com/youtube/vitess/go/bson.EncodeString函数的典型用法代码示例。如果您正苦于以下问题:Golang EncodeString函数的具体用法?Golang EncodeString怎么用?Golang EncodeString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EncodeString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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()
}
示例2: 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()
}
示例3: 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()
}
示例4: 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()
}
示例5: 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()
}
示例6: 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()
}
示例7: 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()
}
示例8: MarshalBson
// MarshalBson bson-encodes GetSrvKeyspaceArgs.
func (getSrvKeyspaceArgs *GetSrvKeyspaceArgs) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Cell", getSrvKeyspaceArgs.Cell)
bson.EncodeString(buf, "Keyspace", getSrvKeyspaceArgs.Keyspace)
lenWriter.Close()
}
示例9: MarshalBson
func (kr *KeyRange) MarshalBson(buf *bytes2.ChunkedWriter) {
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Start", string(kr.Start))
bson.EncodeString(buf, "End", string(kr.End))
buf.WriteByte(0)
lenWriter.RecordLen()
}
示例10: MarshalBson
// MarshalBson bson-encodes CallerID.
func (callerID *CallerID) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Principal", callerID.Principal)
bson.EncodeString(buf, "Component", callerID.Component)
bson.EncodeString(buf, "Subcomponent", callerID.Subcomponent)
lenWriter.Close()
}
示例11: MarshalBson
// MarshalBson marshals response to the given writer with optional prefix
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)
lenWriter.Close()
}
示例12: 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")
bson.EncodeString(buf, "MasterCell", srvShard.MasterCell)
lenWriter.Close()
}
示例13: MarshalBson
func (resp *ResponseBson) MarshalBson(buf *bytes2.ChunkedWriter) {
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "ServiceMethod", resp.ServiceMethod)
bson.EncodeInt64(buf, "Seq", int64(resp.Seq))
bson.EncodeString(buf, "Error", resp.Error)
buf.WriteByte(0)
lenWriter.RecordLen()
}
示例14: MarshalBson
func (kr *KeyRange) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Start", string(kr.Start))
bson.EncodeString(buf, "End", string(kr.End))
buf.WriteByte(0)
lenWriter.RecordLen()
}
示例15: MarshalBson
// MarshalBson bson-encodes ShardSession.
func (shardSession *ShardSession) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Keyspace", shardSession.Keyspace)
bson.EncodeString(buf, "Shard", shardSession.Shard)
shardSession.TabletType.MarshalBson(buf, "TabletType")
bson.EncodeInt64(buf, "TransactionId", shardSession.TransactionId)
lenWriter.Close()
}