本文整理汇总了Golang中github.com/youtube/vitess/go/vt/key.KeyRange.UnmarshalBson方法的典型用法代码示例。如果您正苦于以下问题:Golang KeyRange.UnmarshalBson方法的具体用法?Golang KeyRange.UnmarshalBson怎么用?Golang KeyRange.UnmarshalBson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/key.KeyRange
的用法示例。
在下文中一共展示了KeyRange.UnmarshalBson方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UnmarshalBson
// 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)
}
}
}