本文整理汇总了Golang中github.com/youtube/vitess/go/bson.DecodeBool函数的典型用法代码示例。如果您正苦于以下问题:Golang DecodeBool函数的具体用法?Golang DecodeBool怎么用?Golang DecodeBool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DecodeBool函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: UnmarshalBson
func (zkNode *ZkNode) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Path":
zkNode.Path = bson.DecodeString(buf, kind)
case "Data":
zkNode.Data = bson.DecodeString(buf, kind)
case "Stat":
if kind != bson.Object {
panic(bson.NewBsonError("Unexpected data type %v for Stat", kind))
}
zkNode.Stat.UnmarshalBson(buf)
case "Children":
zkNode.Children = bson.DecodeStringArray(buf, kind)
case "Cached":
zkNode.Cached = bson.DecodeBool(buf, kind)
case "Stale":
zkNode.Stale = bson.DecodeBool(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s for ZkNode", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:28,代码来源:zkocc_bson.go
示例2: UnmarshalBson
// UnmarshalBson bson-decodes into A.
func (a *A) 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 A", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Name":
a.Name = bson.DecodeString(buf, kind)
case "BirthDay":
a.BirthDay = bson.DecodeTime(buf, kind)
case "Phone":
a.Phone = bson.DecodeString(buf, kind)
case "Siblings":
a.Siblings = bson.DecodeInt(buf, kind)
case "Spouse":
a.Spouse = bson.DecodeBool(buf, kind)
case "Money":
a.Money = bson.DecodeFloat64(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:MarkBruns,项目名称:go_serialization_benchmarks,代码行数:31,代码来源:vitess_test.go
示例3: UnmarshalBson
// UnmarshalBson bson-decodes into BatchQueryShard.
func (batchQueryShard *BatchQueryShard) 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 BatchQueryShard", 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 batchQueryShard.Queries", kind))
}
bson.Next(buf, 4)
batchQueryShard.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)
batchQueryShard.Queries = append(batchQueryShard.Queries, _v1)
}
}
case "Keyspace":
batchQueryShard.Keyspace = bson.DecodeString(buf, kind)
case "Shards":
// []string
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for batchQueryShard.Shards", kind))
}
bson.Next(buf, 4)
batchQueryShard.Shards = make([]string, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 string
_v2 = bson.DecodeString(buf, kind)
batchQueryShard.Shards = append(batchQueryShard.Shards, _v2)
}
}
case "TabletType":
batchQueryShard.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
batchQueryShard.Session = new(Session)
(*batchQueryShard.Session).UnmarshalBson(buf, kind)
}
case "NotInTransaction":
batchQueryShard.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:61,代码来源:batch_query_shard_bson.go
示例4: UnmarshalBson
// UnmarshalBson bson-decodes into ZkNode.
func (zkNode *ZkNode) 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 ZkNode", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Path":
zkNode.Path = bson.DecodeString(buf, kind)
case "Data":
zkNode.Data = bson.DecodeString(buf, kind)
case "Stat":
zkNode.Stat.UnmarshalBson(buf, kind)
case "Children":
// []string
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for zkNode.Children", kind))
}
bson.Next(buf, 4)
zkNode.Children = make([]string, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 string
_v1 = bson.DecodeString(buf, kind)
zkNode.Children = append(zkNode.Children, _v1)
}
}
case "Cached":
zkNode.Cached = bson.DecodeBool(buf, kind)
case "Stale":
zkNode.Stale = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:44,代码来源:zknode_bson.go
示例5: UnmarshalBson
// UnmarshalBson bson-decodes into Query.
func (query *Query) 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 Query", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "CallerID":
// *tproto.CallerID
if kind != bson.Null {
query.CallerID = new(tproto.CallerID)
(*query.CallerID).UnmarshalBson(buf, kind)
}
case "Sql":
query.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 query.BindVariables", kind))
}
bson.Next(buf, 4)
query.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)
query.BindVariables[_k] = _v1
}
}
case "TabletType":
query.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
query.Session = new(Session)
(*query.Session).UnmarshalBson(buf, kind)
}
case "NotInTransaction":
query.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:richarwu,项目名称:vitess,代码行数:52,代码来源:query_bson.go
示例6: 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 "CallerID":
// *tproto.CallerID
if kind != bson.Null {
keyspaceIdBatchQuery.CallerID = new(tproto.CallerID)
(*keyspaceIdBatchQuery.CallerID).UnmarshalBson(buf, kind)
}
case "Queries":
// []BoundKeyspaceIdQuery
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([]BoundKeyspaceIdQuery, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 BoundKeyspaceIdQuery
_v1.UnmarshalBson(buf, kind)
keyspaceIdBatchQuery.Queries = append(keyspaceIdBatchQuery.Queries, _v1)
}
}
case "TabletType":
keyspaceIdBatchQuery.TabletType.UnmarshalBson(buf, kind)
case "AsTransaction":
keyspaceIdBatchQuery.AsTransaction = bson.DecodeBool(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
keyspaceIdBatchQuery.Session = new(Session)
(*keyspaceIdBatchQuery.Session).UnmarshalBson(buf, kind)
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:richarwu,项目名称:vitess,代码行数:50,代码来源:keyspace_id_batch_query_bson.go
示例7: UnmarshalBson
// UnmarshalBson unmarshals Session from buf.
func (session *Session) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "InTransaction":
session.InTransaction = bson.DecodeBool(buf, kind)
case "ShardSessions":
session.ShardSessions = decodeShardSessionsBson(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:rjammala,项目名称:vitess,代码行数:18,代码来源:vtgate_proto.go
示例8: UnmarshalBson
// UnmarshalBson unmarshals Session from buf.
func (session *Session) 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 "InTransaction":
session.InTransaction = bson.DecodeBool(buf, kind)
case "ShardSessions":
session.ShardSessions = decodeShardSessionsBson(buf, kind)
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
开发者ID:rudyLi,项目名称:vitess,代码行数:19,代码来源:vtgate_proto.go
示例9: UnmarshalBson
// UnmarshalBson bson-decodes into MyType.
func (myType *MyType) 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 MyType", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Float64":
myType.Float64 = bson.DecodeFloat64(buf, kind)
case "String":
myType.String = bson.DecodeString(buf, kind)
case "Bool":
myType.Bool = bson.DecodeBool(buf, kind)
case "Int64":
myType.Int64 = bson.DecodeInt64(buf, kind)
case "Int32":
myType.Int32 = bson.DecodeInt32(buf, kind)
case "Int":
myType.Int = bson.DecodeInt(buf, kind)
case "Uint64":
myType.Uint64 = bson.DecodeUint64(buf, kind)
case "Uint32":
myType.Uint32 = bson.DecodeUint32(buf, kind)
case "Uint":
myType.Uint = bson.DecodeUint(buf, kind)
case "Bytes":
myType.Bytes = bson.DecodeBinary(buf, kind)
case "Time":
myType.Time = bson.DecodeTime(buf, kind)
case "Interface":
myType.Interface = bson.DecodeInterface(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:hfeeki,项目名称:vitess,代码行数:43,代码来源:output_simple.go
示例10: UnmarshalBson
// UnmarshalBson bson-decodes into Session.
func (session *Session) 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 Session", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "InTransaction":
session.InTransaction = bson.DecodeBool(buf, kind)
case "ShardSessions":
// []*ShardSession
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for session.ShardSessions", kind))
}
bson.Next(buf, 4)
session.ShardSessions = make([]*ShardSession, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 *ShardSession
// *ShardSession
if kind != bson.Null {
_v1 = new(ShardSession)
(*_v1).UnmarshalBson(buf, kind)
}
session.ShardSessions = append(session.ShardSessions, _v1)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:40,代码来源:session_bson.go
示例11: UnmarshalBson
// UnmarshalBson bson-decodes into QueryList.
func (queryList *QueryList) 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 QueryList", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Queries":
// []BoundQuery
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for queryList.Queries", kind))
}
bson.Next(buf, 4)
queryList.Queries = make([]BoundQuery, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 BoundQuery
_v1.UnmarshalBson(buf, kind)
queryList.Queries = append(queryList.Queries, _v1)
}
}
case "SessionId":
queryList.SessionId = bson.DecodeInt64(buf, kind)
case "AsTransaction":
queryList.AsTransaction = bson.DecodeBool(buf, kind)
case "TransactionId":
queryList.TransactionId = bson.DecodeInt64(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:richarwu,项目名称:vitess,代码行数:40,代码来源:query_list_bson.go
示例12: 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 "CallerID":
// *tproto.CallerID
if kind != bson.Null {
keyRangeQuery.CallerID = new(tproto.CallerID)
(*keyRangeQuery.CallerID).UnmarshalBson(buf, kind)
}
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":
// []key.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([]key.KeyRange, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 key.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)
}
case "NotInTransaction":
keyRangeQuery.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:richarwu,项目名称:vitess,代码行数:69,代码来源:key_range_query_bson.go
示例13: UnmarshalBson
// UnmarshalBson bson-decodes into QueryShard.
func (queryShard *QueryShard) 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 QueryShard", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Sql":
queryShard.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 queryShard.BindVariables", kind))
}
bson.Next(buf, 4)
queryShard.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)
queryShard.BindVariables[_k] = _v1
}
}
case "Keyspace":
queryShard.Keyspace = bson.DecodeString(buf, kind)
case "Shards":
// []string
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for queryShard.Shards", kind))
}
bson.Next(buf, 4)
queryShard.Shards = make([]string, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 string
_v2 = bson.DecodeString(buf, kind)
queryShard.Shards = append(queryShard.Shards, _v2)
}
}
case "TabletType":
queryShard.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
queryShard.Session = new(Session)
(*queryShard.Session).UnmarshalBson(buf, kind)
}
case "NotInTransaction":
queryShard.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:63,代码来源:query_shard_bson.go
示例14: 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 "EntityKeyspaceIDs":
// []EntityId
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for entityIdsQuery.EntityKeyspaceIDs", kind))
}
bson.Next(buf, 4)
entityIdsQuery.EntityKeyspaceIDs = make([]EntityId, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 EntityId
_v2.UnmarshalBson(buf, kind)
entityIdsQuery.EntityKeyspaceIDs = append(entityIdsQuery.EntityKeyspaceIDs, _v2)
}
}
case "TabletType":
entityIdsQuery.TabletType.UnmarshalBson(buf, kind)
case "Session":
// *Session
if kind != bson.Null {
entityIdsQuery.Session = new(Session)
(*entityIdsQuery.Session).UnmarshalBson(buf, kind)
}
case "NotInTransaction":
entityIdsQuery.NotInTransaction = bson.DecodeBool(buf, kind)
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:65,代码来源:entity_ids_query_bson.go
注:本文中的github.com/youtube/vitess/go/bson.DecodeBool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论