本文整理汇总了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)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:61,代码来源:keyspace_id_query_bson.go
示例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)
}
}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:61,代码来源:keyspace_id_batch_query_bson.go
示例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))
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:6,代码来源:diff_utils.go
示例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)
}
}
}
开发者ID:nosix-me,项目名称:vitess,代码行数:63,代码来源:entity_ids_query_bson.go
注:本文中的github.com/youtube/vitess/go/vt/key.KeyspaceId类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论