本文整理匯總了Golang中github.com/pingcap/tidb/xapi.SubResult類的典型用法代碼示例。如果您正苦於以下問題:Golang SubResult類的具體用法?Golang SubResult怎麽用?Golang SubResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SubResult類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: extractRowsFromSubResult
func (e *XSelectIndexExec) extractRowsFromSubResult(t table.Table, subResult *xapi.SubResult) ([]*Row, error) {
var rows []*Row
for {
h, rowData, err := subResult.Next()
if err != nil {
return nil, errors.Trace(err)
}
if rowData == nil {
break
}
if e.aggregate {
// compose aggreagte row
row := &Row{Data: rowData}
rows = append(rows, row)
continue
}
fullRowData := make([]types.Datum, len(e.indexPlan.Fields()))
var j int
for i, field := range e.indexPlan.Fields() {
if field.Referenced {
fullRowData[i] = rowData[j]
j++
}
}
row := resultRowToRow(t, h, fullRowData, e.indexPlan.TableAsName)
rows = append(rows, row)
}
return rows, nil
}
示例2: extractHandlesFromIndexSubResult
func extractHandlesFromIndexSubResult(subResult *xapi.SubResult) ([]int64, error) {
var handles []int64
for {
h, data, err := subResult.Next()
if err != nil {
return nil, errors.Trace(err)
}
if data == nil {
break
}
handles = append(handles, h)
}
return handles, nil
}
示例3: extractRowsFromSubResult
func extractRowsFromSubResult(t table.Table, subResult *xapi.SubResult) ([]*Row, error) {
var rows []*Row
for {
h, rowData, err := subResult.Next()
if err != nil {
return nil, errors.Trace(err)
}
if rowData == nil {
break
}
row := resultRowToRow(t, h, rowData)
rows = append(rows, row)
}
return rows, nil
}
示例4: extractRowsFromSubResult
func (e *NewXSelectIndexExec) extractRowsFromSubResult(t table.Table, subResult *xapi.SubResult) ([]*Row, error) {
var rows []*Row
for {
h, rowData, err := subResult.Next()
if err != nil {
return nil, errors.Trace(err)
}
if rowData == nil {
break
}
row := resultRowToRow(t, h, rowData, e.indexPlan.TableAsName)
rows = append(rows, row)
}
return rows, nil
}