本文整理匯總了Golang中github.com/cockroachdb/cockroach/proto.ScanResponse.SetGoError方法的典型用法代碼示例。如果您正苦於以下問題:Golang ScanResponse.SetGoError方法的具體用法?Golang ScanResponse.SetGoError怎麽用?Golang ScanResponse.SetGoError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cockroachdb/cockroach/proto.ScanResponse
的用法示例。
在下文中一共展示了ScanResponse.SetGoError方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Scan
// Scan scans the key range specified by start key through end key up
// to some maximum number of results. The last key of the iteration is
// returned with the reply.
func (r *Range) Scan(args *proto.ScanRequest, reply *proto.ScanResponse) {
kvs, err := r.engine.Scan(args.Key, args.EndKey, args.MaxResults)
if err != nil {
reply.SetGoError(err)
return
}
reply.Rows = make([]proto.KeyValue, len(kvs))
for idx, kv := range kvs {
// TODO(Jiang-Ming): provide the correct timestamp and checksum once switch to mvcc
reply.Rows[idx] = proto.KeyValue{Key: kv.Key, Value: proto.Value{Bytes: kv.Value}}
}
}
示例2: Scan
// Scan scans the key range specified by start key through end key up
// to some maximum number of results. The last key of the iteration is
// returned with the reply.
func (r *Range) Scan(batch engine.Engine, args *proto.ScanRequest, reply *proto.ScanResponse) []proto.Intent {
kvs, intents, err := engine.MVCCScan(batch, args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.ReadConsistency == proto.CONSISTENT, args.Txn)
reply.Rows = kvs
reply.SetGoError(err)
return intents
}
示例3: Scan
// Scan scans the key range specified by start key through end key up
// to some maximum number of results. The last key of the iteration is
// returned with the reply.
func (r *Range) Scan(args *proto.ScanRequest, reply *proto.ScanResponse) {
kvs, err := r.mvcc.Scan(args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.Txn)
reply.Rows = kvs
reply.SetGoError(err)
}