本文整理汇总了Golang中github.com/youtube/vitess/go/vt/key.KeyspaceId类的典型用法代码示例。如果您正苦于以下问题:Golang KeyspaceId类的具体用法?Golang KeyspaceId怎么用?Golang KeyspaceId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KeyspaceId类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: UnmarshalBson
// UnmarshalBson bson-decodes into KeyspaceIdQuery.
func (keyspaceIdQuery *KeyspaceIdQuery) 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 KeyspaceIdQuery", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Sql":
keyspaceIdQuery.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 keyspaceIdQuery.BindVariables", kind))
}
bson.Next(buf, 4)
keyspaceIdQuery.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)
keyspaceIdQuery.BindVariables[_k] = _v1
}
}
case "Keyspace":
keyspaceIdQuery.Keyspace = bson.DecodeString(buf, kind)
case "KeyspaceIds":
// []kproto.KeyspaceId
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for keyspaceIdQuery.KeyspaceIds", kind))
}
bson.Next(buf, 4)
keyspaceIdQuery.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)
keyspaceIdQuery.KeyspaceIds = append(keyspaceIdQuery.KeyspaceIds, _v2)
}
}
case "TabletType":
keyspaceIdQuery.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
keyspaceIdQuery.Session = new(Session)
(*keyspaceIdQuery.Session).UnmarshalBson(buf, kind)
}
default:
bson.Skip(buf, kind)
}
}
}
示例2: UnmarshalBson
// 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":
// []key.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([]key.KeyspaceId, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 key.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)
}
case "NotInTransaction":
keyspaceIdBatchQuery.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
示例3: uint64FromKeyspaceId
// uint64FromKeyspaceId returns a 64 bits hex number as a string
// (in the form of 0x0123456789abcdef) from the provided keyspaceId
func uint64FromKeyspaceId(keyspaceId key.KeyspaceId) string {
hex := string(keyspaceId.Hex())
return "0x" + hex + strings.Repeat("0", 16-len(hex))
}
示例4: UnmarshalBson
// 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 "EntityKeyspaceIdMap":
// map[string]kproto.KeyspaceId
if kind != bson.Null {
if kind != bson.Object {
panic(bson.NewBsonError("unexpected kind %v for entityIdsQuery.EntityKeyspaceIdMap", kind))
}
bson.Next(buf, 4)
entityIdsQuery.EntityKeyspaceIdMap = make(map[string]kproto.KeyspaceId)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
_k := bson.ReadCString(buf)
var _v2 kproto.KeyspaceId
_v2.UnmarshalBson(buf, kind)
entityIdsQuery.EntityKeyspaceIdMap[_k] = _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)
}
}
}