本文整理汇总了Golang中github.com/pingcap/tidb/kv.Request.Data方法的典型用法代码示例。如果您正苦于以下问题:Golang Request.Data方法的具体用法?Golang Request.Data怎么用?Golang Request.Data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pingcap/tidb/kv.Request
的用法示例。
在下文中一共展示了Request.Data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: prepareIndexRequest
func prepareIndexRequest(simpleInfo *simpleTableInfo, startTs uint64) (*kv.Request, error) {
selReq := new(tipb.SelectRequest)
selReq.IndexInfo = simpleInfo.toPBIndexInfo(0)
selReq.StartTs = startTs
selReq.Ranges = []*tipb.KeyRange{fullPBIndexRange}
data, err := proto.Marshal(selReq)
if err != nil {
return nil, errors.Trace(err)
}
req := new(kv.Request)
req.Tp = kv.ReqTypeIndex
req.Concurrency = 1
req.KeyRanges = []kv.KeyRange{fullIndexRange(simpleInfo.tID, simpleInfo.iIDs[0])}
req.Data = data
return req, nil
}
示例2: prepareSelectRequest
func prepareSelectRequest(simpleInfo *simpleTableInfo, startTs uint64) (*kv.Request, error) {
selReq := new(tipb.SelectRequest)
selReq.TableInfo = simpleInfo.toPBTableInfo()
selReq.StartTs = proto.Uint64(startTs)
selReq.Ranges = []*tipb.KeyRange{fullPBTableRange}
data, err := proto.Marshal(selReq)
if err != nil {
return nil, errors.Trace(err)
}
req := new(kv.Request)
req.Tp = kv.ReqTypeSelect
req.Concurrency = 1
req.KeyRanges = []kv.KeyRange{fullTableRange(simpleInfo.tID)}
req.Data = data
return req, nil
}