func (this *builder) VisitIndexNest(node *algebra.IndexNest) (interface{}, error) { _, err := node.Left().Accept(this) if err != nil { return nil, err } right := node.Right() right.SetDefaultNamespace(this.namespace) namespace, err := this.datastore.NamespaceByName(right.Namespace()) if err != nil { return nil, err } keyspace, err := namespace.KeyspaceByName(right.Keyspace()) if err != nil { return nil, err } nest, err := this.buildIndexNest(keyspace, node) if err != nil { return nil, err } this.subChildren = append(this.subChildren, nest) return nil, nil }
func (this *builder) buildIndexNest(keyspace datastore.Keyspace, node *algebra.IndexNest) (op *plan.IndexNest, err error) { index, covers, err := this.buildJoinScan(keyspace, node.Right(), "nest") if err != nil { return nil, err } return plan.NewIndexNest(keyspace, node, index, covers), nil }
func NewIndexNest(keyspace datastore.Keyspace, nest *algebra.IndexNest, index datastore.Index, covers expression.Covers) *IndexNest { rv := &IndexNest{ keyspace: keyspace, term: nest.Right(), outer: nest.Outer(), keyFor: nest.For(), index: index, covers: covers, } rv.idExpr = expression.NewField( expression.NewMeta(expression.NewIdentifier(rv.keyFor)), expression.NewFieldName("id", false)) return rv }