本文整理匯總了Golang中github.com/cockroachdb/cockroach/proto.ScanResponse類的典型用法代碼示例。如果您正苦於以下問題:Golang ScanResponse類的具體用法?Golang ScanResponse怎麽用?Golang ScanResponse使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ScanResponse類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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(batch engine.Engine, args proto.ScanRequest) (proto.ScanResponse, []proto.Intent, error) {
var reply proto.ScanResponse
rows, intents, err := engine.MVCCScan(batch, args.Key, args.EndKey, args.MaxResults, args.Timestamp, args.ReadConsistency == proto.CONSISTENT, args.Txn)
reply.Rows = rows
return reply, intents, err
}
示例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(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}}
}
}
示例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(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
}
示例4: 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)
}