// KnownFunctions private static Func <IDocumentFilterBuilder, object> NotInvocation(FuncFilterQuerySyntaxVisitor visitor, InvocationQuerySyntaxNode node) { // not(condition) --> f.Not(condition) var condition = visitor.Visit(node.Arguments[0]); return(f => f.Not(condition(f))); }
public static Func <IDocumentFilterBuilder, object> CreateFilterExpression(InvocationQuerySyntaxNode node) { var visitor = new FuncFilterQuerySyntaxVisitor(); var filterBody = visitor.Visit(node); return(filterBody); }
private static Func <IDocumentFilterBuilder, object> MatchInvocation(FuncFilterQuerySyntaxVisitor visitor, InvocationQuerySyntaxNode node) { // match(arrayProperty, filter) --> f.Match("arrayProperty", filter(f)) var arrayProperty = node.Arguments[0].AsIdentifierName(); var filter = visitor.Visit(node.Arguments[1]); return(f => f.Match(arrayProperty, filter(f))); }
private static Func <IDocumentFilterBuilder, object> CreateSizeFilterForArrayProperty(FuncFilterQuerySyntaxVisitor visitor, InvocationQuerySyntaxNode node, Func <IDocumentFilterBuilder, string, int, object> filter) { // filter(arrayProperty, value) --> filter("arrayProperty", value) var arrayProperty = node.Arguments[0].AsIdentifierName(); var value = visitor.Visit(node.Arguments[1]); return(f => filter(f, arrayProperty, (int)value(f))); }
private static Func <IDocumentFilterBuilder, object> LteInvocation(FuncFilterQuerySyntaxVisitor visitor, InvocationQuerySyntaxNode node) { // lte(property, value) --> f.Lte("property", value) var property = node.Arguments[0].AsIdentifierName(); var value = visitor.Visit(node.Arguments[1]); return(f => f.Lte(property, value(f))); }