本文整理匯總了Golang中github.com/youtube/vitess/go/sqltypes.Result.UnmarshalBson方法的典型用法代碼示例。如果您正苦於以下問題:Golang Result.UnmarshalBson方法的具體用法?Golang Result.UnmarshalBson怎麽用?Golang Result.UnmarshalBson使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/sqltypes.Result
的用法示例。
在下文中一共展示了Result.UnmarshalBson方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UnmarshalBson
// UnmarshalBson bson-decodes into QueryResultList.
func (queryResultList *QueryResultList) 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 QueryResultList", kind))
}
bson.Next(buf, 4)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
switch bson.ReadCString(buf) {
case "List":
// []sqltypes.Result
if kind != bson.Null {
if kind != bson.Array {
panic(bson.NewBsonError("unexpected kind %v for queryResultList.List", kind))
}
bson.Next(buf, 4)
queryResultList.List = make([]sqltypes.Result, 0, 8)
for kind := bson.NextByte(buf); kind != bson.EOO; kind = bson.NextByte(buf) {
bson.SkipIndex(buf)
var _v1 sqltypes.Result
_v1.UnmarshalBson(buf, kind)
queryResultList.List = append(queryResultList.List, _v1)
}
}
case "Err":
// *mproto.RPCError
if kind != bson.Null {
queryResultList.Err = new(mproto.RPCError)
(*queryResultList.Err).UnmarshalBson(buf, kind)
}
default:
bson.Skip(buf, kind)
}
}
}