本文整理汇总了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
}