예제 #1
0
        public override async IAsyncEnumerable <Path> ComputeSelect(EvaluationContext ctx)
        {
            _listCandidate ??= TemplexBase.Parse(ListExpression);

            if (_listCandidate != null)
            {
                // Expression select
                var select = _listCandidate.ComputeSelect(ctx);
                await foreach (var atom in select)
                {
                    yield return(atom);
                }

                // Expression paths
                var paths = _listCandidate.ComputePaths(ctx);
                await foreach (var path in paths)
                {
                    yield return(path.Append("Id"));
                }

                // Inner template select
                var scopedCtx = ctx.Clone();
                scopedCtx.SetLocalVariable(IteratorVariableName, new EvaluationVariable(
                                               eval: TemplateUtil.VariableThatThrows(IteratorVariableName),
                                               selectResolver: () => select,
                                               pathsResolver: () => paths
                                               ));

                await foreach (var atom in Inner.ComputeSelect(scopedCtx))
                {
                    yield return(atom);
                }
            }
        }
예제 #2
0
        public override async IAsyncEnumerable <Path> ComputeSelect(EvaluationContext ctx)
        {
            var scopedCtx = GetScopeLocalContext(ctx);

            await foreach (var path in Inner.ComputeSelect(scopedCtx))
            {
                yield return(path);
            }
        }
예제 #3
0
        public override async IAsyncEnumerable <Path> ComputeSelect(EvaluationContext ctx)
        {
            var ctxClone = ctx.Clone();

            ctxClone.SetLocalVariable(VariableName, new EvaluationVariable(
                                          eval: TemplateUtil.VariableThatThrows(varName: VariableName), // This is what makes it a "static" context
                                          pathsResolver: () => AsyncUtil.Singleton(Path.Empty(QueryInfo))
                                          ));

            await foreach (var path in Inner.ComputeSelect(ctxClone))
            {
                yield return(path);
            }
        }
예제 #4
0
        public override async IAsyncEnumerable <Path> ComputeSelect(EvaluationContext ctx)
        {
            _conditionCandidate ??= TemplexBase.Parse(ConditionExpression);

            if (_conditionCandidate != null && Inner != null)
            {
                await foreach (var select in _conditionCandidate.ComputeSelect(ctx))
                {
                    yield return(select);
                }

                await foreach (var select in Inner.ComputeSelect(ctx))
                {
                    yield return(select);
                }
            }
        }