// 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) } } }