本文整理汇总了Golang中github.com/youtube/vitess/go/bson.EncodeBool函数的典型用法代码示例。如果您正苦于以下问题:Golang EncodeBool函数的具体用法?Golang EncodeBool怎么用?Golang EncodeBool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EncodeBool函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: MarshalBson
func (zkNode *ZkNode) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Path", zkNode.Path)
bson.EncodeString(buf, "Data", zkNode.Data)
zkNode.Stat.MarshalBson(buf, "Stat")
bson.EncodeStringArray(buf, "Children", zkNode.Children)
bson.EncodeBool(buf, "Cached", zkNode.Cached)
bson.EncodeBool(buf, "Stale", zkNode.Stale)
buf.WriteByte(0)
lenWriter.RecordLen()
}
开发者ID:rudyLi,项目名称:vitess,代码行数:14,代码来源:zkocc_bson.go
示例2: MarshalBson
// MarshalBson bson-encodes BatchQueryShard.
func (batchQueryShard *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
// *tproto.CallerID
if batchQueryShard.CallerID == nil {
bson.EncodePrefix(buf, bson.Null, "CallerID")
} else {
(*batchQueryShard.CallerID).MarshalBson(buf, "CallerID")
}
// []BoundShardQuery
{
bson.EncodePrefix(buf, bson.Array, "Queries")
lenWriter := bson.NewLenWriter(buf)
for _i, _v1 := range batchQueryShard.Queries {
_v1.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
batchQueryShard.TabletType.MarshalBson(buf, "TabletType")
bson.EncodeBool(buf, "AsTransaction", batchQueryShard.AsTransaction)
// *Session
if batchQueryShard.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*batchQueryShard.Session).MarshalBson(buf, "Session")
}
lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:31,代码来源:batch_query_shard_bson.go
示例3: MarshalBson
// MarshalBson bson-encodes BatchQueryShard.
func (batchQueryShard *BatchQueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
// []tproto.BoundQuery
{
bson.EncodePrefix(buf, bson.Array, "Queries")
lenWriter := bson.NewLenWriter(buf)
for _i, _v1 := range batchQueryShard.Queries {
_v1.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
bson.EncodeString(buf, "Keyspace", batchQueryShard.Keyspace)
// []string
{
bson.EncodePrefix(buf, bson.Array, "Shards")
lenWriter := bson.NewLenWriter(buf)
for _i, _v2 := range batchQueryShard.Shards {
bson.EncodeString(buf, bson.Itoa(_i), _v2)
}
lenWriter.Close()
}
batchQueryShard.TabletType.MarshalBson(buf, "TabletType")
// *Session
if batchQueryShard.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*batchQueryShard.Session).MarshalBson(buf, "Session")
}
bson.EncodeBool(buf, "NotInTransaction", batchQueryShard.NotInTransaction)
lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:35,代码来源:batch_query_shard_bson.go
示例4: MarshalBson
// MarshalBson bson-encodes KeyRangeQuery.
func (keyRangeQuery *KeyRangeQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Sql", keyRangeQuery.Sql)
// map[string]interface{}
{
bson.EncodePrefix(buf, bson.Object, "BindVariables")
lenWriter := bson.NewLenWriter(buf)
for _k, _v1 := range keyRangeQuery.BindVariables {
bson.EncodeInterface(buf, _k, _v1)
}
lenWriter.Close()
}
bson.EncodeString(buf, "Keyspace", keyRangeQuery.Keyspace)
// []key.KeyRange
{
bson.EncodePrefix(buf, bson.Array, "KeyRanges")
lenWriter := bson.NewLenWriter(buf)
for _i, _v2 := range keyRangeQuery.KeyRanges {
_v2.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
keyRangeQuery.TabletType.MarshalBson(buf, "TabletType")
// *Session
if keyRangeQuery.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*keyRangeQuery.Session).MarshalBson(buf, "Session")
}
bson.EncodeBool(buf, "NotInTransaction", keyRangeQuery.NotInTransaction)
lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:36,代码来源:key_range_query_bson.go
示例5: MarshalBson
// MarshalBson bson-encodes QueryShard.
func (queryShard *QueryShard) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Sql", queryShard.Sql)
// map[string]interface{}
{
bson.EncodePrefix(buf, bson.Object, "BindVariables")
lenWriter := bson.NewLenWriter(buf)
for _k, _v1 := range queryShard.BindVariables {
bson.EncodeInterface(buf, _k, _v1)
}
lenWriter.Close()
}
bson.EncodeString(buf, "Keyspace", queryShard.Keyspace)
// []string
{
bson.EncodePrefix(buf, bson.Array, "Shards")
lenWriter := bson.NewLenWriter(buf)
for _i, _v2 := range queryShard.Shards {
bson.EncodeString(buf, bson.Itoa(_i), _v2)
}
lenWriter.Close()
}
queryShard.TabletType.MarshalBson(buf, "TabletType")
// *Session
if queryShard.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*queryShard.Session).MarshalBson(buf, "Session")
}
bson.EncodeBool(buf, "NotInTransaction", queryShard.NotInTransaction)
lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:36,代码来源:query_shard_bson.go
示例6: MarshalBson
// MarshalBson bson-encodes Query.
func (query *Query) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
// *tproto.CallerID
if query.CallerID == nil {
bson.EncodePrefix(buf, bson.Null, "CallerID")
} else {
(*query.CallerID).MarshalBson(buf, "CallerID")
}
bson.EncodeString(buf, "Sql", query.Sql)
// map[string]interface{}
{
bson.EncodePrefix(buf, bson.Object, "BindVariables")
lenWriter := bson.NewLenWriter(buf)
for _k, _v1 := range query.BindVariables {
bson.EncodeInterface(buf, _k, _v1)
}
lenWriter.Close()
}
query.TabletType.MarshalBson(buf, "TabletType")
// *Session
if query.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*query.Session).MarshalBson(buf, "Session")
}
bson.EncodeBool(buf, "NotInTransaction", query.NotInTransaction)
lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:32,代码来源:query_bson.go
示例7: MarshalBson
// MarshalBson bson-encodes KeyspaceIdBatchQuery.
func (keyspaceIdBatchQuery *KeyspaceIdBatchQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
// []tproto.BoundQuery
{
bson.EncodePrefix(buf, bson.Array, "Queries")
lenWriter := bson.NewLenWriter(buf)
for _i, _v1 := range keyspaceIdBatchQuery.Queries {
_v1.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
bson.EncodeString(buf, "Keyspace", keyspaceIdBatchQuery.Keyspace)
// []key.KeyspaceId
{
bson.EncodePrefix(buf, bson.Array, "KeyspaceIds")
lenWriter := bson.NewLenWriter(buf)
for _i, _v2 := range keyspaceIdBatchQuery.KeyspaceIds {
_v2.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
keyspaceIdBatchQuery.TabletType.MarshalBson(buf, "TabletType")
// *Session
if keyspaceIdBatchQuery.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*keyspaceIdBatchQuery.Session).MarshalBson(buf, "Session")
}
bson.EncodeBool(buf, "NotInTransaction", keyspaceIdBatchQuery.NotInTransaction)
lenWriter.Close()
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:35,代码来源:keyspace_id_batch_query_bson.go
示例8: MarshalBson
// MarshalBson marshals Session into buf.
func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter) {
lenWriter := bson.NewLenWriter(buf)
bson.EncodeBool(buf, "InTransaction", session.InTransaction)
encodeShardSessionsBson(session.ShardSessions, "ShardSessions", buf)
buf.WriteByte(0)
lenWriter.RecordLen()
}
开发者ID:rjammala,项目名称:vitess,代码行数:10,代码来源:vtgate_proto.go
示例9: MarshalBson
// MarshalBson marshals Session into buf.
func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeBool(buf, "InTransaction", session.InTransaction)
encodeShardSessionsBson(session.ShardSessions, "ShardSessions", buf)
buf.WriteByte(0)
lenWriter.RecordLen()
}
开发者ID:rudyLi,项目名称:vitess,代码行数:11,代码来源:vtgate_proto.go
示例10: MarshalBson
// MarshalBson bson-encodes ZkNode.
func (zkNode *ZkNode) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Path", zkNode.Path)
bson.EncodeString(buf, "Data", zkNode.Data)
zkNode.Stat.MarshalBson(buf, "Stat")
// []string
{
bson.EncodePrefix(buf, bson.Array, "Children")
lenWriter := bson.NewLenWriter(buf)
for _i, _v1 := range zkNode.Children {
bson.EncodeString(buf, bson.Itoa(_i), _v1)
}
lenWriter.Close()
}
bson.EncodeBool(buf, "Cached", zkNode.Cached)
bson.EncodeBool(buf, "Stale", zkNode.Stale)
lenWriter.Close()
}
开发者ID:chinna1986,项目名称:vitess,代码行数:22,代码来源:zknode_bson.go
示例11: MarshalBson
// MarshalBson bson-encodes A.
func (a *A) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeString(buf, "Name", a.Name)
bson.EncodeTime(buf, "BirthDay", a.BirthDay)
bson.EncodeString(buf, "Phone", a.Phone)
bson.EncodeInt(buf, "Siblings", a.Siblings)
bson.EncodeBool(buf, "Spouse", a.Spouse)
bson.EncodeFloat64(buf, "Money", a.Money)
lenWriter.Close()
}
开发者ID:MarkBruns,项目名称:go_serialization_benchmarks,代码行数:14,代码来源:vitess_test.go
示例12: MarshalBson
func (zkNode *ZkNode) MarshalBson(buf *bytes2.ChunkedWriter) {
lenWriter := bson.NewLenWriter(buf)
bson.EncodePrefix(buf, bson.Binary, "Path")
bson.EncodeString(buf, zkNode.Path)
bson.EncodePrefix(buf, bson.Binary, "Data")
bson.EncodeString(buf, zkNode.Data)
bson.EncodePrefix(buf, bson.Object, "Stat")
zkNode.Stat.MarshalBson(buf)
bson.EncodeStringArray(buf, "Children", zkNode.Children)
bson.EncodePrefix(buf, bson.Boolean, "Cached")
bson.EncodeBool(buf, zkNode.Cached)
bson.EncodePrefix(buf, bson.Boolean, "Stale")
bson.EncodeBool(buf, zkNode.Stale)
buf.WriteByte(0)
lenWriter.RecordLen()
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:23,代码来源:zkocc_bson.go
示例13: MarshalBson
// MarshalBson bson-encodes MyType.
func (myType *MyType) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeFloat64(buf, "Float64", myType.Float64)
bson.EncodeString(buf, "String", myType.String)
bson.EncodeBool(buf, "Bool", myType.Bool)
bson.EncodeInt64(buf, "Int64", myType.Int64)
bson.EncodeInt32(buf, "Int32", myType.Int32)
bson.EncodeInt(buf, "Int", myType.Int)
bson.EncodeUint64(buf, "Uint64", myType.Uint64)
bson.EncodeUint32(buf, "Uint32", myType.Uint32)
bson.EncodeUint(buf, "Uint", myType.Uint)
bson.EncodeBinary(buf, "Bytes", myType.Bytes)
bson.EncodeTime(buf, "Time", myType.Time)
bson.EncodeInterface(buf, "Interface", myType.Interface)
lenWriter.Close()
}
开发者ID:hfeeki,项目名称:vitess,代码行数:20,代码来源:output_simple.go
示例14: MarshalBson
// MarshalBson bson-encodes QueryList.
func (queryList *QueryList) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
// []BoundQuery
{
bson.EncodePrefix(buf, bson.Array, "Queries")
lenWriter := bson.NewLenWriter(buf)
for _i, _v1 := range queryList.Queries {
_v1.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
bson.EncodeInt64(buf, "SessionId", queryList.SessionId)
bson.EncodeBool(buf, "AsTransaction", queryList.AsTransaction)
bson.EncodeInt64(buf, "TransactionId", queryList.TransactionId)
lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:20,代码来源:query_list_bson.go
示例15: MarshalBson
// MarshalBson bson-encodes EntityIdsQuery.
func (entityIdsQuery *EntityIdsQuery) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
// *tproto.CallerID
if entityIdsQuery.CallerID == nil {
bson.EncodePrefix(buf, bson.Null, "CallerID")
} else {
(*entityIdsQuery.CallerID).MarshalBson(buf, "CallerID")
}
bson.EncodeString(buf, "Sql", entityIdsQuery.Sql)
// map[string]interface{}
{
bson.EncodePrefix(buf, bson.Object, "BindVariables")
lenWriter := bson.NewLenWriter(buf)
for _k, _v1 := range entityIdsQuery.BindVariables {
bson.EncodeInterface(buf, _k, _v1)
}
lenWriter.Close()
}
bson.EncodeString(buf, "Keyspace", entityIdsQuery.Keyspace)
bson.EncodeString(buf, "EntityColumnName", entityIdsQuery.EntityColumnName)
// []EntityId
{
bson.EncodePrefix(buf, bson.Array, "EntityKeyspaceIDs")
lenWriter := bson.NewLenWriter(buf)
for _i, _v2 := range entityIdsQuery.EntityKeyspaceIDs {
_v2.MarshalBson(buf, bson.Itoa(_i))
}
lenWriter.Close()
}
entityIdsQuery.TabletType.MarshalBson(buf, "TabletType")
// *Session
if entityIdsQuery.Session == nil {
bson.EncodePrefix(buf, bson.Null, "Session")
} else {
(*entityIdsQuery.Session).MarshalBson(buf, "Session")
}
bson.EncodeBool(buf, "NotInTransaction", entityIdsQuery.NotInTransaction)
lenWriter.Close()
}
开发者ID:richarwu,项目名称:vitess,代码行数:43,代码来源:entity_ids_query_bson.go
示例16: MarshalBson
// MarshalBson bson-encodes Session.
func (session *Session) MarshalBson(buf *bytes2.ChunkedWriter, key string) {
bson.EncodeOptionalPrefix(buf, bson.Object, key)
lenWriter := bson.NewLenWriter(buf)
bson.EncodeBool(buf, "InTransaction", session.InTransaction)
// []*ShardSession
{
bson.EncodePrefix(buf, bson.Array, "ShardSessions")
lenWriter := bson.NewLenWriter(buf)
for _i, _v1 := range session.ShardSessions {
// *ShardSession
if _v1 == nil {
bson.EncodePrefix(buf, bson.Null, bson.Itoa(_i))
} else {
(*_v1).MarshalBson(buf, bson.Itoa(_i))
}
}
lenWriter.Close()
}
lenWriter.Close()
}
开发者ID:chinna1986,项目名称:vitess,代码行数:23,代码来源:session_bson.go
注:本文中的github.com/youtube/vitess/go/bson.EncodeBool函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论