本文整理汇总了Golang中github.com/youtube/vitess/go/bson.NewBsonError函数的典型用法代码示例。如果您正苦于以下问题:Golang NewBsonError函数的具体用法?Golang NewBsonError怎么用?Golang NewBsonError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewBsonError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: 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)
}
}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:61,代码来源:batch_query_shard_bson.go
示例2: UnmarshalBson
// UnmarshalBson bson-decodes into ReplicationPosition.
func (rp *ReplicationPosition) 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 ReplicationPosition", kind))
}
bson.Next(buf, 4)
// We expect exactly zero or one fields in this bson object.
kind = bson.NextByte(buf)
if kind == bson.EOO {
// The value was nil, nothing to do.
return
}
// The field name is the MySQL flavor.
flavor := bson.ReadCString(buf)
value := bson.DecodeString(buf, kind)
// Check for and consume the end byte.
if kind = bson.NextByte(buf); kind != bson.EOO {
panic(bson.NewBsonError("too many fields for ReplicationPosition"))
}
// Parse the value.
var err error
*rp, err = ParseReplicationPosition(flavor, value)
if err != nil {
panic(bson.NewBsonError("invalid value %#v for ReplicationPosition: %v", value, err))
}
}
开发者ID:richarwu,项目名称:vitess,代码行数:35,代码来源:replication.go
示例3: UnmarshalBson
// UnmarshalBson bson-decodes into SrvKeyspaceNames.
func (srvKeyspaceNames *SrvKeyspaceNames) 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 SrvKeyspaceNames", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Entries":
// []string
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for srvKeyspaceNames.Entries", kind))
}
bson.Next(buf, 4)
srvKeyspaceNames.Entries = make([]string, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 string
_v1 = bson.DecodeString(buf, kind)
srvKeyspaceNames.Entries = append(srvKeyspaceNames.Entries, _v1)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:richarwu,项目名称:vitess,代码行数:34,代码来源:srv_keyspace_names_bson.go
示例4: UnmarshalBson
// UnmarshalBson bson-decodes into ZkPathV.
func (zkPathV *ZkPathV) 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 ZkPathV", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Paths":
// []string
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for zkPathV.Paths", kind))
}
bson.Next(buf, 4)
zkPathV.Paths = make([]string, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 string
_v1 = bson.DecodeString(buf, kind)
zkPathV.Paths = append(zkPathV.Paths, _v1)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:34,代码来源:zkpathv_bson.go
示例5: DecodeKeyspacePartitionMap
func DecodeKeyspacePartitionMap(buf *bytes.Buffer, kind byte) map[TabletType]*KeyspacePartition {
switch kind {
case bson.Object:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for KeyspacePartition map", kind))
}
bson.Next(buf, 4)
values := make(map[TabletType]*KeyspacePartition)
kind = bson.NextByte(buf)
for kind != bson.EOO {
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for KeyspacePartition map", kind))
}
key := bson.ReadCString(buf)
value := &KeyspacePartition{}
value.UnmarshalBson(buf)
values[TabletType(key)] = value
kind = bson.NextByte(buf)
}
return values
}
开发者ID:rjammala,项目名称:vitess,代码行数:25,代码来源:srvshard.go
示例6: UnmarshalStatementsBson
func UnmarshalStatementsBson(buf *bytes.Buffer, kind byte) []Statement {
switch kind {
case bson.Array:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for BinlogTransaction.Statements", kind))
}
bson.Next(buf, 4)
statements := make([]Statement, 0, 8)
kind = bson.NextByte(buf)
for i := 0; kind != bson.EOO; i++ {
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for Query.Field", kind))
}
bson.ExpectIndex(buf, i)
var statement Statement
statement.UnmarshalBson(buf)
statements = append(statements, statement)
kind = bson.NextByte(buf)
}
return statements
}
开发者ID:rjammala,项目名称:vitess,代码行数:25,代码来源:binlog_transaction.go
示例7: decodeShardSessionsBson
func decodeShardSessionsBson(buf *bytes.Buffer, kind byte) []*ShardSession {
switch kind {
case bson.Array:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for ShardSessions", kind))
}
bson.Next(buf, 4)
shardSessions := make([]*ShardSession, 0, 8)
kind = bson.NextByte(buf)
for kind != bson.EOO {
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for ShardSession", kind))
}
bson.SkipIndex(buf)
shardSession := new(ShardSession)
shardSession.UnmarshalBson(buf, kind)
shardSessions = append(shardSessions, shardSession)
kind = bson.NextByte(buf)
}
return shardSessions
}
开发者ID:rudyLi,项目名称:vitess,代码行数:25,代码来源:vtgate_proto.go
示例8: UnmarshalBson
// UnmarshalBson bson-decodes into BinlogTransaction.
func (binlogTransaction *BinlogTransaction) 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 BinlogTransaction", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Statements":
// []Statement
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for binlogTransaction.Statements", kind))
}
bson.Next(buf, 4)
binlogTransaction.Statements = make([]Statement, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 Statement
_v1.UnmarshalBson(buf, kind)
binlogTransaction.Statements = append(binlogTransaction.Statements, _v1)
}
}
case "GroupId":
binlogTransaction.GroupId = bson.DecodeInt64(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:nosix-me,项目名称:vitess,代码行数:36,代码来源:binlog_transaction_bson.go
示例9: UnmarshalBson
// UnmarshalBson bson-decodes into KeyspacePartition.
func (keyspacePartition *KeyspacePartition) 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 KeyspacePartition", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "ShardReferences":
// []ShardReference
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for keyspacePartition.ShardReferences", kind))
}
bson.Next(buf, 4)
keyspacePartition.ShardReferences = make([]ShardReference, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 ShardReference
_v1.UnmarshalBson(buf, kind)
keyspacePartition.ShardReferences = append(keyspacePartition.ShardReferences, _v1)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:kuipertan,项目名称:vitess,代码行数:34,代码来源:keyspace_partition_bson.go
示例10: UnmarshalBson
// UnmarshalBson bson-decodes into GTIDField.
func (gf *GTIDField) 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 GTIDField", kind))
}
bson.Next(buf, 4)
// We expect exactly zero or one fields in this bson object.
kind = bson.NextByte(buf)
if kind == bson.EOO {
// The GTID was nil, nothing to do.
return
}
// The field name is the MySQL flavor.
flavor := bson.ReadCString(buf)
value := bson.DecodeString(buf, kind)
// Check for and consume the end byte.
if kind = bson.NextByte(buf); kind != bson.EOO {
panic(bson.NewBsonError("too many fields for GTIDField"))
}
// Parse the value.
gtid, err := ParseGTID(flavor, value)
if err != nil {
panic(bson.NewBsonError("invalid value %v for GTIDField: %v", value, err))
}
gf.Value = gtid
}
开发者ID:chinna1986,项目名称:vitess,代码行数:35,代码来源:gtid.go
示例11: DecodeFieldsBson
func DecodeFieldsBson(buf *bytes.Buffer, kind byte) []Field {
switch kind {
case bson.Array:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for Query.Fields", kind))
}
bson.Next(buf, 4)
fields := make([]Field, 0, 8)
kind = bson.NextByte(buf)
for kind != bson.EOO {
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for Query.Field", kind))
}
bson.SkipIndex(buf)
var field Field
UnmarshalFieldBson(&field, buf)
fields = append(fields, field)
kind = bson.NextByte(buf)
}
return fields
}
开发者ID:rudyLi,项目名称:vitess,代码行数:25,代码来源:bson.go
示例12: 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)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:61,代码来源:keyspace_id_query_bson.go
示例13: UnmarshalBson
// UnmarshalBson bson-decodes into BlpPositionList.
func (blpPositionList *BlpPositionList) 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 BlpPositionList", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Entries":
// []BlpPosition
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for blpPositionList.Entries", kind))
}
bson.Next(buf, 4)
blpPositionList.Entries = make([]BlpPosition, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 BlpPosition
_v1.UnmarshalBson(buf, kind)
blpPositionList.Entries = append(blpPositionList.Entries, _v1)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:34,代码来源:blp_position_list_bson.go
示例14: UnmarshalBson
// UnmarshalBson bson-decodes into BoundQuery.
func (boundQuery *BoundQuery) 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 BoundQuery", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Sql":
boundQuery.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 boundQuery.BindVariables", kind))
}
bson.Next(buf, 4)
boundQuery.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)
boundQuery.BindVariables[_k] = _v1
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:36,代码来源:bound_query_bson.go
示例15: UnmarshalBson
// UnmarshalBson bson-decodes into QueryResultList.
func (queryResultList *QueryResultList) 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 QueryResultList", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "List":
// []mproto.QueryResult
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for queryResultList.List", kind))
}
bson.Next(buf, 4)
queryResultList.List = make([]mproto.QueryResult, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 mproto.QueryResult
_v1.UnmarshalBson(buf, kind)
queryResultList.List = append(queryResultList.List, _v1)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:34,代码来源:query_result_list_bson.go
示例16: unmarshalZkNodeArray
func unmarshalZkNodeArray(buf *bytes.Buffer, name string, kind byte) []*ZkNode {
switch kind {
case bson.Array:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for %v", kind, name))
}
bson.Next(buf, 4)
values := make([]*ZkNode, 0, 8)
kind = bson.NextByte(buf)
for i := 0; kind != bson.EOO; i++ {
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for %v", kind, name))
}
bson.ExpectIndex(buf, i)
zkNode := &ZkNode{}
zkNode.UnmarshalBson(buf)
values = append(values, zkNode)
kind = bson.NextByte(buf)
}
return values
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:25,代码来源:zkocc_bson.go
示例17: 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)
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:28,代码来源:zkocc_bson.go
示例18: DecodeSrvShardArray
func DecodeSrvShardArray(buf *bytes.Buffer, kind byte) []SrvShard {
switch kind {
case bson.Array:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for SrvShard array", kind))
}
bson.Next(buf, 4)
values := make([]SrvShard, 0, 8)
kind = bson.NextByte(buf)
for i := 0; kind != bson.EOO; i++ {
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for SrvShard array", kind))
}
bson.ExpectIndex(buf, i)
value := &SrvShard{}
value.UnmarshalBson(buf)
values = append(values, *value)
kind = bson.NextByte(buf)
}
return values
}
开发者ID:rjammala,项目名称:vitess,代码行数:25,代码来源:srvshard.go
示例19: UnmarshalBson
// UnmarshalBson bson-decodes into KeyspaceIdBatchQuery.
func (keyspaceIdBatchQuery *KeyspaceIdBatchQuery) 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 KeyspaceIdBatchQuery", 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 keyspaceIdBatchQuery.Queries", kind))
}
bson.Next(buf, 4)
keyspaceIdBatchQuery.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)
keyspaceIdBatchQuery.Queries = append(keyspaceIdBatchQuery.Queries, _v1)
}
}
case "Keyspace":
keyspaceIdBatchQuery.Keyspace = bson.DecodeString(buf, kind)
case "KeyspaceIds":
// []kproto.KeyspaceId
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for keyspaceIdBatchQuery.KeyspaceIds", kind))
}
bson.Next(buf, 4)
keyspaceIdBatchQuery.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)
keyspaceIdBatchQuery.KeyspaceIds = append(keyspaceIdBatchQuery.KeyspaceIds, _v2)
}
}
case "TabletType":
keyspaceIdBatchQuery.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
keyspaceIdBatchQuery.Session = new(Session)
(*keyspaceIdBatchQuery.Session).UnmarshalBson(buf, kind)
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:59,代码来源:keyspace_id_batch_query_bson.go
示例20: 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)
}
}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:59,代码来源:srvkeyspace_bson.go
注:本文中的github.com/youtube/vitess/go/bson.NewBsonError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论