// 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) } }
// UnmarshalBson unmarshals BatchQueryShard from buf. func (bqs *BatchQueryShard) UnmarshalBson(buf *bytes.Buffer) { bson.Next(buf, 4) kind := bson.NextByte(buf) for kind != bson.EOO { key := bson.ReadCString(buf) switch key { 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": bqs.Session = new(Session) bqs.Session.UnmarshalBson(buf) default: panic(bson.NewBsonError("Unrecognized tag %s", key)) } kind = bson.NextByte(buf) } }