本文整理汇总了Golang中github.com/youtube/vitess/go/sqltypes.Result类的典型用法代码示例。如果您正苦于以下问题:Golang Result类的具体用法?Golang Result怎么用?Golang Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: appendResult
func appendResult(qr, innerqr *sqltypes.Result) {
if innerqr.RowsAffected == 0 && len(innerqr.Fields) == 0 {
return
}
if qr.Fields == nil {
qr.Fields = innerqr.Fields
}
qr.RowsAffected += innerqr.RowsAffected
if innerqr.InsertID != 0 {
qr.InsertID = innerqr.InsertID
}
qr.Rows = append(qr.Rows, innerqr.Rows...)
}
开发者ID:littleyang,项目名称:vitess,代码行数:13,代码来源:scatter_conn.go
示例2: 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)
}
}
}
开发者ID:BobbWu,项目名称:vitess,代码行数:40,代码来源:query_result_list_bson.go
示例3: appendResult
func appendResult(qr, innerqr *sqltypes.Result) {
if innerqr.RowsAffected == 0 && len(innerqr.Fields) == 0 {
return
}
if qr.Fields == nil {
qr.Fields = innerqr.Fields
}
qr.RowsAffected += innerqr.RowsAffected
if innerqr.InsertID != 0 {
qr.InsertID = innerqr.InsertID
}
if len(qr.Rows) == 0 {
// we haven't gotten any result yet, just save the new extras.
qr.Extras = innerqr.Extras
} else {
// Merge the EventTokens / Fresher flags within Extras.
if innerqr.Extras == nil {
// We didn't get any from innerq. Have to clear any
// we'd have gotten already.
if qr.Extras != nil {
qr.Extras.EventToken = nil
qr.Extras.Fresher = false
}
} else {
// We may have gotten an EventToken from
// innerqr. If we also got one earlier, merge
// it. If we didn't get one earlier, we
// discard the new one.
if qr.Extras != nil {
// Note if any of the two is nil, we get nil.
qr.Extras.EventToken = eventtoken.Minimum(qr.Extras.EventToken, innerqr.Extras.EventToken)
qr.Extras.Fresher = qr.Extras.Fresher && innerqr.Extras.Fresher
}
}
}
qr.Rows = append(qr.Rows, innerqr.Rows...)
}
开发者ID:dumbunny,项目名称:vitess,代码行数:38,代码来源:scatter_conn.go
注:本文中的github.com/youtube/vitess/go/sqltypes.Result类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论