// 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)
		}
	}
}
Exemplo n.º 2
0
// 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)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 3
0
// 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)
		}
	}
}
Exemplo n.º 4
0
// UnmarshalBson bson-decodes into QueryShard.
func (queryShard *QueryShard) 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 QueryShard", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Sql":
			queryShard.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 queryShard.BindVariables", kind))
				}
				bson.Next(buf, 4)
				queryShard.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)
					queryShard.BindVariables[_k] = _v1
				}
			}
		case "Keyspace":
			queryShard.Keyspace = bson.DecodeString(buf, kind)
		case "Shards":
			// []string
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for queryShard.Shards", kind))
				}
				bson.Next(buf, 4)
				queryShard.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)
					queryShard.Shards = append(queryShard.Shards, _v2)
				}
			}
		case "TabletType":
			queryShard.TabletType.UnmarshalBson(buf, kind)
		case "Session":
			// *Session
			if kind != bson.Null {
				queryShard.Session = new(Session)
				(*queryShard.Session).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 5
0
// 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)
		}
	}
}
Exemplo n.º 6
0
// 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)
		}
	}
}
Exemplo n.º 7
0
// 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)
		}
	}
}
Exemplo n.º 8
0
// UnmarshalBson bson-decodes into KeyRangeQuery.
func (keyRangeQuery *KeyRangeQuery) 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 KeyRangeQuery", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Sql":
			keyRangeQuery.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 keyRangeQuery.BindVariables", kind))
				}
				bson.Next(buf, 4)
				keyRangeQuery.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)
					keyRangeQuery.BindVariables[_k] = _v1
				}
			}
		case "Keyspace":
			keyRangeQuery.Keyspace = bson.DecodeString(buf, kind)
		case "KeyRanges":
			// []kproto.KeyRange
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for keyRangeQuery.KeyRanges", kind))
				}
				bson.Next(buf, 4)
				keyRangeQuery.KeyRanges = make([]kproto.KeyRange, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v2 kproto.KeyRange
					_v2.UnmarshalBson(buf, kind)
					keyRangeQuery.KeyRanges = append(keyRangeQuery.KeyRanges, _v2)
				}
			}
		case "TabletType":
			keyRangeQuery.TabletType.UnmarshalBson(buf, kind)
		case "Session":
			// *Session
			if kind != bson.Null {
				keyRangeQuery.Session = new(Session)
				(*keyRangeQuery.Session).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 9
0
// 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 "Shards":
			// []SrvShard
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for keyspacePartition.Shards", kind))
				}
				bson.Next(buf, 4)
				keyspacePartition.Shards = make([]SrvShard, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 SrvShard
					_v1.UnmarshalBson(buf, kind)
					keyspacePartition.Shards = append(keyspacePartition.Shards, _v1)
				}
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 10
0
// 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)
		}
	}
}
Exemplo n.º 11
0
// UnmarshalBson bson-decodes into ZkNode.
func (zkNode *ZkNode) 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 ZkNode", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Path":
			zkNode.Path = bson.DecodeString(buf, kind)
		case "Data":
			zkNode.Data = bson.DecodeString(buf, kind)
		case "Stat":
			zkNode.Stat.UnmarshalBson(buf, kind)
		case "Children":
			// []string
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for zkNode.Children", kind))
				}
				bson.Next(buf, 4)
				zkNode.Children = 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)
					zkNode.Children = append(zkNode.Children, _v1)
				}
			}
		case "Cached":
			zkNode.Cached = bson.DecodeBool(buf, kind)
		case "Stale":
			zkNode.Stale = bson.DecodeBool(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 12
0
// UnmarshalBson bson-decodes into Session.
func (session *Session) 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 Session", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "InTransaction":
			session.InTransaction = bson.DecodeBool(buf, kind)
		case "ShardSessions":
			// []*ShardSession
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for session.ShardSessions", kind))
				}
				bson.Next(buf, 4)
				session.ShardSessions = make([]*ShardSession, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 *ShardSession
					// *ShardSession
					if kind != bson.Null {
						_v1 = new(ShardSession)
						(*_v1).UnmarshalBson(buf, kind)
					}
					session.ShardSessions = append(session.ShardSessions, _v1)
				}
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 13
0
// 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 "Timestamp":
			binlogTransaction.Timestamp = bson.DecodeInt64(buf, kind)
		case "GTIDField":
			binlogTransaction.GTIDField.UnmarshalBson(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 14
0
// UnmarshalBson bson-decodes into QueryList.
func (queryList *QueryList) 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 QueryList", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Queries":
			// []BoundQuery
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for queryList.Queries", kind))
				}
				bson.Next(buf, 4)
				queryList.Queries = make([]BoundQuery, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 BoundQuery
					_v1.UnmarshalBson(buf, kind)
					queryList.Queries = append(queryList.Queries, _v1)
				}
			}
		case "SessionId":
			queryList.SessionId = bson.DecodeInt64(buf, kind)
		case "TransactionId":
			queryList.TransactionId = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 15
0
// UnmarshalBson bson-decodes into ZkNodeV.
func (zkNodeV *ZkNodeV) 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 ZkNodeV", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Nodes":
			// []*ZkNode
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for zkNodeV.Nodes", kind))
				}
				bson.Next(buf, 4)
				zkNodeV.Nodes = make([]*ZkNode, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 *ZkNode
					// *ZkNode
					if kind != bson.Null {
						_v1 = new(ZkNode)
						(*_v1).UnmarshalBson(buf, kind)
					}
					zkNodeV.Nodes = append(zkNodeV.Nodes, _v1)
				}
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 16
0
// UnmarshalBson bson-decodes into EntityIdsQuery.
func (entityIdsQuery *EntityIdsQuery) 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 EntityIdsQuery", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Sql":
			entityIdsQuery.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 entityIdsQuery.BindVariables", kind))
				}
				bson.Next(buf, 4)
				entityIdsQuery.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)
					entityIdsQuery.BindVariables[_k] = _v1
				}
			}
		case "Keyspace":
			entityIdsQuery.Keyspace = bson.DecodeString(buf, kind)
		case "EntityColumnName":
			entityIdsQuery.EntityColumnName = bson.DecodeString(buf, kind)
		case "EntityKeyspaceIDs":
			// []EntityId
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for entityIdsQuery.EntityKeyspaceIDs", kind))
				}
				bson.Next(buf, 4)
				entityIdsQuery.EntityKeyspaceIDs = make([]EntityId, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v2 EntityId
					_v2.UnmarshalBson(buf, kind)
					entityIdsQuery.EntityKeyspaceIDs = append(entityIdsQuery.EntityKeyspaceIDs, _v2)
				}
			}
		case "TabletType":
			entityIdsQuery.TabletType.UnmarshalBson(buf, kind)
		case "Session":
			// *Session
			if kind != bson.Null {
				entityIdsQuery.Session = new(Session)
				(*entityIdsQuery.Session).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 17
0
// UnmarshalBson bson-decodes into MyType.
func (myType *MyType) 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 MyType", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Map":
			// map[string]string
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.Map", kind))
				}
				bson.Next(buf, 4)
				myType.Map = make(map[string]string)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v1 string
					_v1 = bson.DecodeString(buf, kind)
					myType.Map[_k] = _v1
				}
			}
		case "MapBytes":
			// map[string][]byte
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapBytes", kind))
				}
				bson.Next(buf, 4)
				myType.MapBytes = make(map[string][]byte)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v2 []byte
					_v2 = bson.DecodeBinary(buf, kind)
					myType.MapBytes[_k] = _v2
				}
			}
		case "MapPtr":
			// map[string]*string
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapPtr", kind))
				}
				bson.Next(buf, 4)
				myType.MapPtr = make(map[string]*string)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v3 *string
					// *string
					if kind != bson.Null {
						_v3 = new(string)
						(*_v3) = bson.DecodeString(buf, kind)
					}
					myType.MapPtr[_k] = _v3
				}
			}
		case "MapSlice":
			// map[string][]string
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapSlice", kind))
				}
				bson.Next(buf, 4)
				myType.MapSlice = make(map[string][]string)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v4 []string
					// []string
					if kind != bson.Null {
						if kind != bson.Array {
							panic(bson.NewBsonError("unexpected kind %v for _v4", kind))
						}
						bson.Next(buf, 4)
						_v4 = make([]string, 0, 8)
						for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
							bson.SkipIndex(buf)
							var _v5 string
							_v5 = bson.DecodeString(buf, kind)
							_v4 = append(_v4, _v5)
						}
					}
					myType.MapSlice[_k] = _v4
				}
			}
		case "MapMap":
			// map[string]map[string]int64
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapMap", kind))
				}
				bson.Next(buf, 4)
				myType.MapMap = make(map[string]map[string]int64)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v6 map[string]int64
					// map[string]int64
					if kind != bson.Null {
						if kind != bson.Object {
							panic(bson.NewBsonError("unexpected kind %v for _v6", kind))
						}
						bson.Next(buf, 4)
						_v6 = make(map[string]int64)
						for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
							_k := bson.ReadCString(buf)
							var _v7 int64
							_v7 = bson.DecodeInt64(buf, kind)
							_v6[_k] = _v7
						}
					}
					myType.MapMap[_k] = _v6
				}
			}
		case "MapCustom":
			// map[string]Custom
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapCustom", kind))
				}
				bson.Next(buf, 4)
				myType.MapCustom = make(map[string]Custom)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v8 Custom
					_v8.UnmarshalBson(buf, kind)
					myType.MapCustom[_k] = _v8
				}
			}
		case "MapCustomPtr":
			// map[string]*Custom
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapCustomPtr", kind))
				}
				bson.Next(buf, 4)
				myType.MapCustomPtr = make(map[string]*Custom)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := bson.ReadCString(buf)
					var _v9 *Custom
					// *Custom
					if kind != bson.Null {
						_v9 = new(Custom)
						(*_v9).UnmarshalBson(buf, kind)
					}
					myType.MapCustomPtr[_k] = _v9
				}
			}
		case "CustomMap":
			// map[Custom]string
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.CustomMap", kind))
				}
				bson.Next(buf, 4)
				myType.CustomMap = make(map[Custom]string)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := Custom(bson.ReadCString(buf))
					var _v10 string
					_v10 = bson.DecodeString(buf, kind)
					myType.CustomMap[_k] = _v10
				}
			}
		case "MapExternal":
			// map[pkg.Custom]string
			if kind != bson.Null {
				if kind != bson.Object {
					panic(bson.NewBsonError("unexpected kind %v for myType.MapExternal", kind))
				}
				bson.Next(buf, 4)
				myType.MapExternal = make(map[pkg.Custom]string)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					_k := pkg.Custom(bson.ReadCString(buf))
					var _v11 string
					_v11 = bson.DecodeString(buf, kind)
					myType.MapExternal[_k] = _v11
				}
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 18
0
// UnmarshalBson bson-decodes into StreamEvent.
func (streamEvent *StreamEvent) 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 StreamEvent", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Category":
			streamEvent.Category = bson.DecodeString(buf, kind)
		case "TableName":
			streamEvent.TableName = bson.DecodeString(buf, kind)
		case "PKColNames":
			// []string
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for streamEvent.PKColNames", kind))
				}
				bson.Next(buf, 4)
				streamEvent.PKColNames = 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)
					streamEvent.PKColNames = append(streamEvent.PKColNames, _v1)
				}
			}
		case "PKValues":
			// [][]interface{}
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for streamEvent.PKValues", kind))
				}
				bson.Next(buf, 4)
				streamEvent.PKValues = make([][]interface{}, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v2 []interface{}
					// []interface{}
					if kind != bson.Null {
						if kind != bson.Array {
							panic(bson.NewBsonError("unexpected kind %v for _v2", kind))
						}
						bson.Next(buf, 4)
						_v2 = make([]interface{}, 0, 8)
						for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
							bson.SkipIndex(buf)
							var _v3 interface{}
							_v3 = bson.DecodeInterface(buf, kind)
							_v2 = append(_v2, _v3)
						}
					}
					streamEvent.PKValues = append(streamEvent.PKValues, _v2)
				}
			}
		case "Sql":
			streamEvent.Sql = bson.DecodeString(buf, kind)
		case "Timestamp":
			streamEvent.Timestamp = bson.DecodeInt64(buf, kind)
		case "GTIDField":
			streamEvent.GTIDField.UnmarshalBson(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 19
0
// UnmarshalBson bson-decodes into MyType.
func (myType *MyType) 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 MyType", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Ptr":
			// *int64
			if kind != bson.Null {
				myType.Ptr = new(int64)
				(*myType.Ptr) = bson.DecodeInt64(buf, kind)
			}
		case "PtrPtr":
			// **int64
			if kind != bson.Null {
				myType.PtrPtr = new(*int64)
				// *int64
				if kind != bson.Null {
					(*myType.PtrPtr) = new(int64)
					(*(*myType.PtrPtr)) = bson.DecodeInt64(buf, kind)
				}
			}
		case "PtrBytes":
			// *[]byte
			if kind != bson.Null {
				myType.PtrBytes = new([]byte)
				(*myType.PtrBytes) = bson.DecodeBinary(buf, kind)
			}
		case "PtrSlice":
			// *[]int64
			if kind != bson.Null {
				myType.PtrSlice = new([]int64)
				// []int64
				if kind != bson.Null {
					if kind != bson.Array {
						panic(bson.NewBsonError("unexpected kind %v for (*myType.PtrSlice)", kind))
					}
					bson.Next(buf, 4)
					(*myType.PtrSlice) = make([]int64, 0, 8)
					for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
						bson.SkipIndex(buf)
						var _v1 int64
						_v1 = bson.DecodeInt64(buf, kind)
						(*myType.PtrSlice) = append((*myType.PtrSlice), _v1)
					}
				}
			}
		case "PtrMap":
			// *map[string]int64
			if kind != bson.Null {
				myType.PtrMap = new(map[string]int64)
				// map[string]int64
				if kind != bson.Null {
					if kind != bson.Object {
						panic(bson.NewBsonError("unexpected kind %v for (*myType.PtrMap)", kind))
					}
					bson.Next(buf, 4)
					(*myType.PtrMap) = make(map[string]int64)
					for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
						_k := bson.ReadCString(buf)
						var _v2 int64
						_v2 = bson.DecodeInt64(buf, kind)
						(*myType.PtrMap)[_k] = _v2
					}
				}
			}
		case "PtrCustom":
			// *Custom
			if kind != bson.Null {
				myType.PtrCustom = new(Custom)
				(*myType.PtrCustom).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 20
0
// UnmarshalBson bson-decodes into QueryResult.
func (queryResult *QueryResult) 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 QueryResult", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Fields":
			// []Field
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for queryResult.Fields", kind))
				}
				bson.Next(buf, 4)
				queryResult.Fields = make([]Field, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v1 Field
					_v1.UnmarshalBson(buf, kind)
					queryResult.Fields = append(queryResult.Fields, _v1)
				}
			}
		case "RowsAffected":
			queryResult.RowsAffected = bson.DecodeUint64(buf, kind)
		case "InsertId":
			queryResult.InsertId = bson.DecodeUint64(buf, kind)
		case "Rows":
			// [][]sqltypes.Value
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for queryResult.Rows", kind))
				}
				bson.Next(buf, 4)
				queryResult.Rows = make([][]sqltypes.Value, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v2 []sqltypes.Value
					// []sqltypes.Value
					if kind != bson.Null {
						if kind != bson.Array {
							panic(bson.NewBsonError("unexpected kind %v for _v2", kind))
						}
						bson.Next(buf, 4)
						_v2 = make([]sqltypes.Value, 0, 8)
						for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
							bson.SkipIndex(buf)
							var _v3 sqltypes.Value
							_v3.UnmarshalBson(buf, kind)
							_v2 = append(_v2, _v3)
						}
					}
					queryResult.Rows = append(queryResult.Rows, _v2)
				}
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Exemplo n.º 21
0
// 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 "Shards":
			// []SrvShard
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for srvKeyspace.Shards", kind))
				}
				bson.Next(buf, 4)
				srvKeyspace.Shards = make([]SrvShard, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v2 SrvShard
					_v2.UnmarshalBson(buf, kind)
					srvKeyspace.Shards = append(srvKeyspace.Shards, _v2)
				}
			}
		case "TabletTypes":
			// []TabletType
			if kind != bson.Null {
				if kind != bson.Array {
					panic(bson.NewBsonError("unexpected kind %v for srvKeyspace.TabletTypes", kind))
				}
				bson.Next(buf, 4)
				srvKeyspace.TabletTypes = make([]TabletType, 0, 8)
				for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
					bson.SkipIndex(buf)
					var _v3 TabletType
					_v3.UnmarshalBson(buf, kind)
					srvKeyspace.TabletTypes = append(srvKeyspace.TabletTypes, _v3)
				}
			}
		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 _v4 string
					_v4 = bson.DecodeString(buf, kind)
					srvKeyspace.ServedFrom[_k] = _v4
				}
			}
		case "SplitShardCount":
			srvKeyspace.SplitShardCount = bson.DecodeInt32(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}