本文整理匯總了Golang中github.com/couchbase/query/algebra.KeyspaceTerm.Indexes方法的典型用法代碼示例。如果您正苦於以下問題:Golang KeyspaceTerm.Indexes方法的具體用法?Golang KeyspaceTerm.Indexes怎麽用?Golang KeyspaceTerm.Indexes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/couchbase/query/algebra.KeyspaceTerm
的用法示例。
在下文中一共展示了KeyspaceTerm.Indexes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: buildScan
func (this *builder) buildScan(keyspace datastore.Keyspace, node *algebra.KeyspaceTerm, limit expression.Expression) (
secondary plan.Operator, primary *plan.PrimaryScan, err error) {
var indexes, hintIndexes, otherIndexes []datastore.Index
hints := node.Indexes()
if hints != nil {
indexes, err = allHints(keyspace, hints)
hintIndexes = indexes
} else {
indexes, err = allIndexes(keyspace)
otherIndexes = indexes
}
if err != nil {
return
}
pred := this.where
if pred != nil {
dnf := NewDNF()
pred = pred.Copy()
pred, err = dnf.Map(pred)
if err != nil {
return
}
formalizer := expression.NewFormalizer()
formalizer.Keyspace = node.Alias()
primaryKey := expression.Expressions{
expression.NewField(
expression.NewMeta(expression.NewConstant(node.Alias())),
expression.NewFieldName("id", false)),
}
sargables, er := sargableIndexes(indexes, pred, primaryKey, dnf, formalizer)
if er != nil {
return nil, nil, er
}
minimals, er := minimalIndexes(sargables, pred)
if er != nil {
return nil, nil, er
}
if len(minimals) > 0 {
secondary, err = this.buildSecondaryScan(minimals, node, limit)
return secondary, nil, err
}
}
primary, err = this.buildPrimaryScan(keyspace, node, limit, hintIndexes, otherIndexes)
return nil, primary, err
}