本文整理汇总了Golang中github.com/youtube/vitess/go/bson.DecodeUint64函数的典型用法代码示例。如果您正苦于以下问题:Golang DecodeUint64函数的具体用法?Golang DecodeUint64怎么用?Golang DecodeUint64使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DecodeUint64函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: UnmarshalBson
// UnmarshalBson unmarshals QueryResult from buf.
func (qr *QueryResult) 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 "Fields":
qr.Fields = mproto.DecodeFieldsBson(buf, kind)
case "RowsAffected":
qr.RowsAffected = bson.DecodeUint64(buf, kind)
case "InsertId":
qr.InsertId = bson.DecodeUint64(buf, kind)
case "Rows":
qr.Rows = mproto.DecodeRowsBson(buf, kind)
case "Session":
if kind != bson.Null {
qr.Session = new(Session)
qr.Session.UnmarshalBson(buf, kind)
}
case "Error":
qr.Error = bson.DecodeString(buf, kind)
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
开发者ID:rudyLi,项目名称:vitess,代码行数:30,代码来源:vtgate_proto.go
示例2: UnmarshalBson
// UnmarshalBson unmarshals QueryResult from buf.
func (qr *QueryResult) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Fields":
qr.Fields = mproto.DecodeFieldsBson(buf, kind)
case "RowsAffected":
qr.RowsAffected = bson.DecodeUint64(buf, kind)
case "InsertId":
qr.InsertId = bson.DecodeUint64(buf, kind)
case "Rows":
qr.Rows = mproto.DecodeRowsBson(buf, kind)
case "Session":
qr.Session = new(Session)
qr.Session.UnmarshalBson(buf)
case "Error":
qr.Error = bson.DecodeString(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:rjammala,项目名称:vitess,代码行数:27,代码来源:vtgate_proto.go
示例3: UnmarshalPKRowBson
func UnmarshalPKRowBson(buf *bytes.Buffer, kind byte) []interface{} {
switch kind {
case bson.Array:
// valid
case bson.Null:
return nil
default:
panic(bson.NewBsonError("Unexpected data type %v for Query.Row", kind))
}
bson.Next(buf, 4)
row := make([]interface{}, 0, 8)
kind = bson.NextByte(buf)
for i := 0; kind != bson.EOO; i++ {
bson.ExpectIndex(buf, i)
var val interface{}
switch kind {
case bson.Binary, bson.String:
val = bson.DecodeString(buf, kind)
case bson.Long:
val = bson.DecodeInt64(buf, kind)
case bson.Ulong:
val = bson.DecodeUint64(buf, kind)
}
row = append(row, val)
kind = bson.NextByte(buf)
}
return row
}
开发者ID:rjammala,项目名称:vitess,代码行数:29,代码来源:stream_event.go
示例4: decodeReplCoordBson
func (pos *BinlogPosition) decodeReplCoordBson(buf *bytes.Buffer, kind byte) {
pos.Position = ReplicationCoordinates{}
bson.Next(buf, 4)
kind = bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "RelayFilename":
pos.Position.RelayFilename = bson.DecodeString(buf, kind)
case "RelayPosition":
pos.Position.RelayPosition = bson.DecodeUint64(buf, kind)
case "MasterFilename":
pos.Position.MasterFilename = bson.DecodeString(buf, kind)
case "MasterPosition":
pos.Position.MasterPosition = bson.DecodeUint64(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:shrutip,项目名称:vitess,代码行数:21,代码来源:binlog_parser.go
示例5: UnmarshalBson
func (pos *BinlogPosition) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Position":
pos.decodeReplCoordBson(buf, kind)
case "Timestamp":
pos.Timestamp = bson.DecodeInt64(buf, kind)
case "Xid":
pos.Xid = bson.DecodeUint64(buf, kind)
case "GroupId":
pos.GroupId = bson.DecodeUint64(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:shrutip,项目名称:vitess,代码行数:21,代码来源:binlog_parser.go
示例6: UnmarshalBson
func (qr *QueryResult) UnmarshalBson(buf *bytes.Buffer, kind byte) {
bson.VerifyObject(kind)
bson.Next(buf, 4)
kind = bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "Fields":
qr.Fields = DecodeFieldsBson(buf, kind)
case "RowsAffected":
qr.RowsAffected = bson.DecodeUint64(buf, kind)
case "InsertId":
qr.InsertId = bson.DecodeUint64(buf, kind)
case "Rows":
qr.Rows = DecodeRowsBson(buf, kind)
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
开发者ID:rudyLi,项目名称:vitess,代码行数:22,代码来源:bson.go
示例7: UnmarshalBson
func (req *RequestBson) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "ServiceMethod":
req.ServiceMethod = bson.DecodeString(buf, kind)
case "Seq":
req.Seq = bson.DecodeUint64(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:17,代码来源:custom_codecs.go
示例8: UnmarshalBson
// UnmarshalBson unmarshals request to the given byte buffer as verifying the
// kind
func (req *RequestBson) UnmarshalBson(buf *bytes.Buffer, kind byte) {
bson.VerifyObject(kind)
bson.Next(buf, 4)
kind = bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "ServiceMethod":
req.ServiceMethod = bson.DecodeString(buf, kind)
case "Seq":
req.Seq = bson.DecodeUint64(buf, kind)
default:
bson.Skip(buf, kind)
}
kind = bson.NextByte(buf)
}
}
开发者ID:littleyang,项目名称:vitess,代码行数:20,代码来源:custom_codecs.go
示例9: UnmarshalBson
func (repl *ReplicationCoordinates) UnmarshalBson(buf *bytes.Buffer) {
bson.Next(buf, 4)
kind := bson.NextByte(buf)
for kind != bson.EOO {
key := bson.ReadCString(buf)
switch key {
case "MasterFilename":
repl.MasterFilename = bson.DecodeString(buf, kind)
case "MasterPosition":
repl.MasterPosition = bson.DecodeUint64(buf, kind)
case "GroupId":
repl.GroupId = bson.DecodeString(buf, kind)
default:
panic(bson.NewBsonError("Unrecognized tag %s", key))
}
kind = bson.NextByte(buf)
}
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:19,代码来源:binlog.go
示例10: 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
示例11: UnmarshalBson
// UnmarshalBson bson-decodes into Result.
func (result *Result) 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 Result", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Fields":
// []*query.Field
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for result.Fields", kind))
}
bson.Next(buf, 4)
result.Fields = make([]*querypb.Field, 0, 8)
var f BSONField
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 *querypb.Field
// *query.Field
_v1 = new(querypb.Field)
bson.UnmarshalFromBuffer(buf, &f)
_v1.Name = f.Name
_v1.Type = MySQLToType(f.Type, f.Flags)
result.Fields = append(result.Fields, _v1)
}
}
case "RowsAffected":
result.RowsAffected = bson.DecodeUint64(buf, kind)
case "InsertId":
result.InsertID = bson.DecodeUint64(buf, kind)
case "Rows":
// [][]Value
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for result.Rows", kind))
}
bson.Next(buf, 4)
result.Rows = make([][]Value, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 []Value
// []Value
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for _v2", kind))
}
bson.Next(buf, 4)
_v2 = make([]Value, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v3 Value
_v3.UnmarshalBson(buf, kind)
_v2 = append(_v2, _v3)
}
}
result.Rows = append(result.Rows, _v2)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:littleyang,项目名称:vitess,代码行数:71,代码来源:result_bson.go
示例12: UnmarshalBson
// UnmarshalBson bson-decodes into QueryResult.
func (queryResult *QueryResult) 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 QueryResult", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "Fields":
// []Field
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for queryResult.Fields", kind))
}
bson.Next(buf, 4)
queryResult.Fields = make([]Field, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 Field
_v1.UnmarshalBson(buf, kind)
queryResult.Fields = append(queryResult.Fields, _v1)
}
}
case "RowsAffected":
queryResult.RowsAffected = bson.DecodeUint64(buf, kind)
case "InsertId":
queryResult.InsertId = bson.DecodeUint64(buf, kind)
case "Rows":
// [][]sqltypes.Value
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for queryResult.Rows", kind))
}
bson.Next(buf, 4)
queryResult.Rows = make([][]sqltypes.Value, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v2 []sqltypes.Value
// []sqltypes.Value
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for _v2", kind))
}
bson.Next(buf, 4)
_v2 = make([]sqltypes.Value, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v3 sqltypes.Value
_v3.UnmarshalBson(buf, kind)
_v2 = append(_v2, _v3)
}
}
queryResult.Rows = append(queryResult.Rows, _v2)
}
}
default:
bson.Skip(buf, kind)
}
}
}
开发者ID:chinna1986,项目名称:vitess,代码行数:66,代码来源:query_result_bson.go
注:本文中的github.com/youtube/vitess/go/bson.DecodeUint64函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论