// 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)
		}
	}
}
Example #2
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 "Result":
			// *mproto.QueryResult
			if kind != bson.Null {
				queryResult.Result = new(mproto.QueryResult)
				(*queryResult.Result).UnmarshalBson(buf, kind)
			}
		case "Session":
			// *Session
			if kind != bson.Null {
				queryResult.Session = new(Session)
				(*queryResult.Session).UnmarshalBson(buf, kind)
			}
		case "Error":
			queryResult.Error = bson.DecodeString(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
// 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)
		}
	}
}
Example #4
0
// UnmarshalBson bson-decodes into Statement.
func (statement *Statement) 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 Statement", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Category":
			statement.Category = bson.DecodeInt(buf, kind)
		case "Charset":
			// *mproto.Charset
			if kind != bson.Null {
				statement.Charset = new(mproto.Charset)
				(*statement.Charset).UnmarshalBson(buf, kind)
			}
		case "Sql":
			statement.Sql = bson.DecodeBinary(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #5
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 "Cust1":
			myType.Cust1.UnmarshalBson(buf, kind)
		case "Cust2":
			// *Custom1
			if kind != bson.Null {
				myType.Cust2 = new(Custom1)
				(*myType.Cust2).UnmarshalBson(buf, kind)
			}
		case "Cust3":
			myType.Cust3.UnmarshalBson(buf, kind)
		case "Cust4":
			// *pkg.Custom2
			if kind != bson.Null {
				myType.Cust4 = new(pkg.Custom2)
				(*myType.Cust4).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #6
0
// 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)
		}
	}
}
Example #7
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)
		}
	}
}
Example #8
0
// 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))
	}
}
Example #9
0
// 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)
		}
	}
}
// 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)
		}
	}
}
// 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)
		}
	}
}
Example #12
0
// 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
}
// 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)
		}
	}
}
Example #14
0
// UnmarshalBson skips over an encoded Unused in a backward-compatible way.
// Previous versions of Unused would BSON-encode a naked string value, which
// bson.EncodeSimple() would encode as a document with a field named
// bson.MAGICTAG. Here we skip over any document or sub-document without looking
// for the special MAGICTAG field name.
func (u *Unused) 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 Unused", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		bson.ReadCString(buf)
		bson.Skip(buf, kind)
	}
}
Example #15
0
// UnmarshalBson bson-decodes into TabletType.
func (tabletType *TabletType) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	if kind == bson.EOO {
		bson.Next(buf, 4)
		kind = bson.NextByte(buf)
		bson.ReadCString(buf)
	}
	*tabletType = TabletType(bson.DecodeString(buf, kind))
}
Example #16
0
// UnmarshalBson bson-decodes into MyType.
func (myType *MyType) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	if kind == bson.EOO {
		bson.Next(buf, 4)
		kind = bson.NextByte(buf)
		bson.ReadCString(buf)
	}
	*myType = MyType(bson.DecodeInt(buf, kind))
}
Example #17
0
// UnmarshalBson bson-decodes into KeyspaceId.
func (keyspaceId *KeyspaceId) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	if kind == bson.EOO {
		bson.Next(buf, 4)
		kind = bson.NextByte(buf)
		bson.ReadCString(buf)
	}
	*keyspaceId = KeyspaceId(bson.DecodeString(buf, kind))
}
Example #18
0
func (req *RequestBson) 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 "ServiceMethod":
			req.ServiceMethod = bson.DecodeString(buf, kind)
		case "Seq":
			req.Seq = bson.DecodeUint64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
		kind = bson.NextByte(buf)
	}
}
Example #19
0
// UnmarshalBson bson-decodes into Query.
func (query *Query) 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 Query", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Sql":
			query.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 query.BindVariables", kind))
				}
				bson.Next(buf, 4)
				query.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)
					query.BindVariables[_k] = _v1
				}
			}
		case "TabletType":
			query.TabletType.UnmarshalBson(buf, kind)
		case "Session":
			// *Session
			if kind != bson.Null {
				query.Session = new(Session)
				(*query.Session).UnmarshalBson(buf, kind)
			}
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #20
0
func (v *Value) UnmarshalBson(buf *bytes.Buffer, kind byte) {
	if kind == bson.EOO {
		bson.Next(buf, 4)
		kind = bson.NextByte(buf)
		bson.ReadCString(buf)
	}
	if kind != bson.Null {
		*v = MakeString(bson.DecodeBinary(buf, kind))
	}
}
Example #21
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)
		}
	}
}
Example #22
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 "Float64":
			myType.Float64 = bson.DecodeFloat64(buf, kind)
		case "String":
			myType.String = bson.DecodeString(buf, kind)
		case "Bool":
			myType.Bool = bson.DecodeBool(buf, kind)
		case "Int64":
			myType.Int64 = bson.DecodeInt64(buf, kind)
		case "Int32":
			myType.Int32 = bson.DecodeInt32(buf, kind)
		case "Int":
			myType.Int = bson.DecodeInt(buf, kind)
		case "Uint64":
			myType.Uint64 = bson.DecodeUint64(buf, kind)
		case "Uint32":
			myType.Uint32 = bson.DecodeUint32(buf, kind)
		case "Uint":
			myType.Uint = bson.DecodeUint(buf, kind)
		case "Bytes":
			myType.Bytes = bson.DecodeBinary(buf, kind)
		case "Time":
			myType.Time = bson.DecodeTime(buf, kind)
		case "Interface":
			myType.Interface = bson.DecodeInterface(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #23
0
// UnmarshalBson bson-decodes into ZkPath.
func (zkPath *ZkPath) 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 ZkPath", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Path":
			zkPath.Path = bson.DecodeString(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #24
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 "Val":
			myType.Val = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #25
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)
		}
	}
}
Example #26
0
// UnmarshalBson bson-decodes into ZkStat.
func (zkStat *ZkStat) 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 ZkStat", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Czxid":
			zkStat.czxid = bson.DecodeInt64(buf, kind)
		case "Mzxid":
			zkStat.mzxid = bson.DecodeInt64(buf, kind)
		case "CTime":
			zkStat.cTime = bson.DecodeTime(buf, kind)
		case "MTime":
			zkStat.mTime = bson.DecodeTime(buf, kind)
		case "Version":
			zkStat.version = bson.DecodeInt(buf, kind)
		case "CVersion":
			zkStat.cVersion = bson.DecodeInt(buf, kind)
		case "AVersion":
			zkStat.aVersion = bson.DecodeInt(buf, kind)
		case "EphemeralOwner":
			zkStat.ephemeralOwner = bson.DecodeInt64(buf, kind)
		case "DataLength":
			zkStat.dataLength = bson.DecodeInt(buf, kind)
		case "NumChildren":
			zkStat.numChildren = bson.DecodeInt(buf, kind)
		case "Pzxid":
			zkStat.pzxid = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #27
0
// UnmarshalBson bson-decodes into Field.
func (field *Field) 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 Field", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Name":
			field.Name = bson.DecodeString(buf, kind)
		case "Type":
			field.Type = bson.DecodeInt64(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #28
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)
		}
	}
}
Example #29
0
// UnmarshalBson bson-decodes into BlpPosition.
func (blpPosition *BlpPosition) 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 BlpPosition", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "Uid":
			blpPosition.Uid = bson.DecodeUint32(buf, kind)
		case "Position":
			blpPosition.Position.UnmarshalBson(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}
Example #30
0
// UnmarshalBson bson-decodes into EntityId.
func (entityId *EntityId) 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 EntityId", kind))
	}
	bson.Next(buf, 4)

	for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
		switch bson.ReadCString(buf) {
		case "ExternalID":
			entityId.ExternalID = bson.DecodeInterface(buf, kind)
		case "KeyspaceID":
			entityId.KeyspaceID.UnmarshalBson(buf, kind)
		default:
			bson.Skip(buf, kind)
		}
	}
}