本文整理汇总了Golang中github.com/youtube/vitess/go/bson.DecodeString函数的典型用法代码示例。如果您正苦于以下问题:Golang DecodeString函数的具体用法?Golang DecodeString怎么用?Golang DecodeString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DecodeString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UnmarshalBson
func (sqs *StreamQueryKeyRange) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
keyName := bson.ReadCString(buf)
switch keyName {
case "Sql":
sqs.Sql = bson.DecodeString(buf, kind)
case "BindVariables":
sqs.BindVariables = tproto.DecodeBindVariablesBson(buf, kind)
case "Keyspace":
sqs.Keyspace = bson.DecodeString(buf, kind)
case "KeyRange":
sqs.KeyRange = bson.DecodeString(buf, kind)
case "TabletType":
sqs.TabletType = topo.TabletType(bson.DecodeString(buf, kind))
case "Session":
sqs.Session = new(Session)
sqs.Session.UnmarshalBson(buf)
default:
panic(bson.NewBsonError("Unrecognized tag %s", keyName))
}
kind = bson.NextByte(buf)
}
}
示例2: UnmarshalBson
// UnmarshalBson unmarshals BatchQueryShard from buf.
func (bqs *BatchQueryShard) UnmarshalBson(buf *bytes.Buffer, kind byte) {
bson.VerifyObject(kind)
bson.Next(buf, 4)
kind = bson.NextByte(buf)
for kind != bson.EOO {
keyName := bson.ReadCString(buf)
switch keyName {
case "Queries":
bqs.Queries = tproto.DecodeQueriesBson(buf, kind)
case "Keyspace":
bqs.Keyspace = bson.DecodeString(buf, kind)
case "Shards":
bqs.Shards = bson.DecodeStringArray(buf, kind)
case "TabletType":
bqs.TabletType = topo.TabletType(bson.DecodeString(buf, kind))
case "Session":
if kind != bson.Null {
bqs.Session = new(Session)
bqs.Session.UnmarshalBson(buf, kind)
}
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
示例3: UnmarshalBson
func (zkNode *ZkNode) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Path":
zkNode.Path = bson.DecodeString(buf, kind)
case "Data":
zkNode.Data = bson.DecodeString(buf, kind)
case "Stat":
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for Stat", kind))
}
zkNode.Stat.UnmarshalBson(buf)
case "Children":
zkNode.Children = bson.DecodeStringArray(buf, kind)
case "Cached":
zkNode.Cached = bson.DecodeBool(buf, kind)
case "Stale":
zkNode.Stale = bson.DecodeBool(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s for ZkNode", key))
}
kind = bson.NextByte(buf)
}
}
示例4: UnmarshalBson
func (sk *SrvKeyspace) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
keyName := bson.ReadCString(buf)
switch keyName {
case "Partitions":
sk.Partitions = DecodeKeyspacePartitionMap(buf, kind)
case "Shards":
sk.Shards = DecodeSrvShardArray(buf, kind)
case "TabletTypes":
sk.TabletTypes = DecodeTabletTypeArray(buf, kind)
case "ShardingColumnName":
sk.ShardingColumnName = bson.DecodeString(buf, kind)
case "ShardingColumnType":
sk.ShardingColumnType = key.KeyspaceIdType(bson.DecodeString(buf, kind))
case "ServedFrom":
sk.ServedFrom = DecodeServedFrom(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", keyName))
}
kind = bson.NextByte(buf)
}
}
示例5: UnmarshalBson
// UnmarshalBson bson-decodes into ShardSession.
func (shardSession *ShardSession) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for ShardSession", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Keyspace":
shardSession.Keyspace = bson.DecodeString(buf, kind)
case "Shard":
shardSession.Shard = bson.DecodeString(buf, kind)
case "TabletType":
shardSession.TabletType.UnmarshalBson(buf, kind)
case "TransactionId":
shardSession.TransactionId = bson.DecodeInt64(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
示例6: UnmarshalBson
func (sk *SrvKeyspace) UnmarshalBson(buf *bytes.Buffer, kind byte) {
bson.VerifyObject(kind)
bson.Next(buf, 4)
kind = bson.NextByte(buf)
for kind != bson.EOO {
keyName := bson.ReadCString(buf)
switch keyName {
case "Partitions":
sk.Partitions = DecodeKeyspacePartitionMap(buf, kind)
case "Shards":
sk.Shards = DecodeSrvShardArray(buf, kind)
case "TabletTypes":
sk.TabletTypes = DecodeTabletTypeArray(buf, kind)
case "ShardingColumnName":
sk.ShardingColumnName = bson.DecodeString(buf, kind)
case "ShardingColumnType":
sk.ShardingColumnType = key.KeyspaceIdType(bson.DecodeString(buf, kind))
case "ServedFrom":
sk.ServedFrom = DecodeServedFrom(buf, kind)
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
示例7: UnmarshalBson
// UnmarshalBson unmarshals QueryShard from buf.
func (qrs *QueryShard) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Sql":
qrs.Sql = bson.DecodeString(buf, kind)
case "BindVariables":
qrs.BindVariables = tproto.DecodeBindVariablesBson(buf, kind)
case "Keyspace":
qrs.Keyspace = bson.DecodeString(buf, kind)
case "TabletType":
qrs.TabletType = topo.TabletType(bson.DecodeString(buf, kind))
case "Shards":
qrs.Shards = bson.DecodeStringArray(buf, kind)
case "Session":
qrs.Session = new(Session)
qrs.Session.UnmarshalBson(buf)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
示例8: UnmarshalBson
func (ste *StreamEvent) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Category":
ste.Category = bson.DecodeString(buf, kind)
case "TableName":
ste.TableName = bson.DecodeString(buf, kind)
case "PKColNames":
ste.PKColNames = bson.DecodeStringArray(buf, kind)
case "PKValues":
ste.PKValues = UnmarshalPKValuesBson(buf, kind)
case "Sql":
ste.Sql = bson.DecodeString(buf, kind)
case "Timestamp":
ste.Timestamp = bson.DecodeInt64(buf, kind)
case "GroupId":
ste.GroupId = bson.DecodeInt64(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
示例9: UnmarshalBson
// UnmarshalBson bson-decodes into A.
func (a *A) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for A", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Name":
a.Name = bson.DecodeString(buf, kind)
case "BirthDay":
a.BirthDay = bson.DecodeTime(buf, kind)
case "Phone":
a.Phone = bson.DecodeString(buf, kind)
case "Siblings":
a.Siblings = bson.DecodeInt(buf, kind)
case "Spouse":
a.Spouse = bson.DecodeBool(buf, kind)
case "Money":
a.Money = bson.DecodeFloat64(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
示例10: UnmarshalBson
// UnmarshalBson bson-decodes into GetEndPointsArgs.
func (getEndPointsArgs *GetEndPointsArgs) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for GetEndPointsArgs", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Cell":
getEndPointsArgs.Cell = bson.DecodeString(buf, kind)
case "Keyspace":
getEndPointsArgs.Keyspace = bson.DecodeString(buf, kind)
case "Shard":
getEndPointsArgs.Shard = bson.DecodeString(buf, kind)
case "TabletType":
getEndPointsArgs.TabletType.UnmarshalBson(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
示例11: UnmarshalBson
// UnmarshalBson bson-decodes into KeyspaceIdQuery.
func (keyspaceIdQuery *KeyspaceIdQuery) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for KeyspaceIdQuery", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Sql":
keyspaceIdQuery.Sql = bson.DecodeString(buf, kind)
case "BindVariables":
// map[string]interface{}
if kind != bson.Null {
if kind != bson.Object {
panic(bson.NewBsonError("unexpected kind %v for keyspaceIdQuery.BindVariables", kind))
}
bson.Next(buf, 4)
keyspaceIdQuery.BindVariables = make(map[string]interface{})
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
_k := bson.ReadCString(buf)
var _v1 interface{}
_v1 = bson.DecodeInterface(buf, kind)
keyspaceIdQuery.BindVariables[_k] = _v1
}
}
case "Keyspace":
keyspaceIdQuery.Keyspace = bson.DecodeString(buf, kind)
case "KeyspaceIds":
// []kproto.KeyspaceId
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for keyspaceIdQuery.KeyspaceIds", kind))
}
bson.Next(buf, 4)
keyspaceIdQuery.KeyspaceIds = make([]kproto.KeyspaceId, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 kproto.KeyspaceId
_v2.UnmarshalBson(buf, kind)
keyspaceIdQuery.KeyspaceIds = append(keyspaceIdQuery.KeyspaceIds, _v2)
}
}
case "TabletType":
keyspaceIdQuery.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
keyspaceIdQuery.Session = new(Session)
(*keyspaceIdQuery.Session).UnmarshalBson(buf, kind)
}
default:
bson.Skip(buf, kind)
}
}
}
示例12: UnmarshalBson
// UnmarshalBson bson-decodes into BatchQueryShard.
func (batchQueryShard *BatchQueryShard) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for BatchQueryShard", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Queries":
// []tproto.BoundQuery
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for batchQueryShard.Queries", kind))
}
bson.Next(buf, 4)
batchQueryShard.Queries = make([]tproto.BoundQuery, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 tproto.BoundQuery
_v1.UnmarshalBson(buf, kind)
batchQueryShard.Queries = append(batchQueryShard.Queries, _v1)
}
}
case "Keyspace":
batchQueryShard.Keyspace = bson.DecodeString(buf, kind)
case "Shards":
// []string
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for batchQueryShard.Shards", kind))
}
bson.Next(buf, 4)
batchQueryShard.Shards = make([]string, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 string
_v2 = bson.DecodeString(buf, kind)
batchQueryShard.Shards = append(batchQueryShard.Shards, _v2)
}
}
case "TabletType":
batchQueryShard.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
batchQueryShard.Session = new(Session)
(*batchQueryShard.Session).UnmarshalBson(buf, kind)
}
case "NotInTransaction":
batchQueryShard.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
示例13: UnmarshalBson
func (ste *StreamEvent) UnmarshalBson(buf *bytes.Buffer, kind byte) {
bson.VerifyObject(kind)
bson.Next(buf, 4)
kind = bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Category":
ste.Category = bson.DecodeString(buf, kind)
case "TableName":
ste.TableName = bson.DecodeString(buf, kind)
case "PKColNames":
ste.PKColNames = bson.DecodeStringArray(buf, kind)
case "PKValues":
ste.PKValues = UnmarshalPKValuesBson(buf, kind)
case "Sql":
ste.Sql = bson.DecodeString(buf, kind)
case "Timestamp":
ste.Timestamp = bson.DecodeInt64(buf, kind)
case "GroupId":
ste.GroupId = bson.DecodeInt64(buf, kind)
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
示例14: UnmarshalBson
// UnmarshalBson bson-decodes into SrvKeyspace.
func (srvKeyspace *SrvKeyspace) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for SrvKeyspace", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Partitions":
// map[TabletType]*KeyspacePartition
if kind != bson.Null {
if kind != bson.Object {
panic(bson.NewBsonError("unexpected kind %v for srvKeyspace.Partitions", kind))
}
bson.Next(buf, 4)
srvKeyspace.Partitions = make(map[TabletType]*KeyspacePartition)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
_k := TabletType(bson.ReadCString(buf))
var _v1 *KeyspacePartition
// *KeyspacePartition
if kind != bson.Null {
_v1 = new(KeyspacePartition)
(*_v1).UnmarshalBson(buf, kind)
}
srvKeyspace.Partitions[_k] = _v1
}
}
case "ShardingColumnName":
srvKeyspace.ShardingColumnName = bson.DecodeString(buf, kind)
case "ShardingColumnType":
srvKeyspace.ShardingColumnType.UnmarshalBson(buf, kind)
case "ServedFrom":
// map[TabletType]string
if kind != bson.Null {
if kind != bson.Object {
panic(bson.NewBsonError("unexpected kind %v for srvKeyspace.ServedFrom", kind))
}
bson.Next(buf, 4)
srvKeyspace.ServedFrom = make(map[TabletType]string)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
_k := TabletType(bson.ReadCString(buf))
var _v2 string
_v2 = bson.DecodeString(buf, kind)
srvKeyspace.ServedFrom[_k] = _v2
}
}
case "SplitShardCount":
srvKeyspace.SplitShardCount = bson.DecodeInt32(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
示例15: UnmarshalBson
// UnmarshalBson bson-decodes into SrvShard.
func (srvShard *SrvShard) UnmarshalBson(buf *bytes.Buffer, kind byte) {
switch kind {
case bson.EOO, bson.Object:
// valid
case bson.Null:
return
default:
panic(bson.NewBsonError("unexpected kind %v for SrvShard", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Name":
srvShard.Name = bson.DecodeString(buf, kind)
case "KeyRange":
srvShard.KeyRange.UnmarshalBson(buf, kind)
case "ServedTypes":
// []TabletType
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for srvShard.ServedTypes", kind))
}
bson.Next(buf, 4)
srvShard.ServedTypes = make([]TabletType, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 TabletType
_v1.UnmarshalBson(buf, kind)
srvShard.ServedTypes = append(srvShard.ServedTypes, _v1)
}
}
case "MasterCell":
srvShard.MasterCell = bson.DecodeString(buf, kind)
case "TabletTypes":
// []TabletType
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for srvShard.TabletTypes", kind))
}
bson.Next(buf, 4)
srvShard.TabletTypes = make([]TabletType, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 TabletType
_v2.UnmarshalBson(buf, kind)
srvShard.TabletTypes = append(srvShard.TabletTypes, _v2)
}
}
default:
bson.Skip(buf, kind)
}
}
}