/// <inheritdoc />
 protected override Condition HandleListOperation(
     Neo4JFilterVisitorContext context,
     IFilterField field,
     Neo4JFilterScope scope,
     string path) =>
 field.Type is IComparableOperationFilterInputType
         ? CreateArrayAllScalar(scope, path)
         : CreateArrayAll(scope, path);
        public override Condition HandleOperation(
            Neo4JFilterVisitorContext context,
            IFilterOperationField field,
            IValueNode value,
            object?parsedValue)
        {
            if (parsedValue is not string str)
            {
                throw new InvalidOperationException();
            }

            return(context
                   .GetNode()
                   .Property(context.GetNeo4JFilterScope().GetPath())
                   .EndsWith(Cypher.LiteralOf(str)));
        }
        /// <inheritdoc />
        public override Condition HandleOperation(
            Neo4JFilterVisitorContext context,
            IFilterOperationField field,
            IValueNode value,
            object?parsedValue)
        {
            if (parsedValue is null)
            {
                throw new InvalidOperationException();
            }

            return(context
                   .GetNode()
                   .Property(context.GetNeo4JFilterScope().GetPath())
                   .GreaterThanOEqualTo(Cypher.LiteralOf(parsedValue))
                   .Not());
        }
Esempio n. 4
0
 /// <summary>
 /// Tries to build the query based on the items that are stored on the scope
 /// </summary>
 /// <param name="context">The context</param>
 /// <param name="query">The query that was build</param>
 /// <returns>True in case the query has been build successfully, otherwise false</returns>
 public static bool TryCreateQuery(
     this Neo4JFilterVisitorContext context,
     [NotNullWhen(true)] out CompoundCondition query)
 {
     return(context.GetNeo4JFilterScope().TryCreateQuery(out query));
 }
Esempio n. 5
0
        public static Node GetNode(this Neo4JFilterVisitorContext context)
        {
            var nodeName = context.RuntimeTypes.Skip(1).First().Type.Name;

            return(Cypher.Node(nodeName).Named(nodeName.ToCamelCase()));
        }
Esempio n. 6
0
 /// <summary>
 /// Reads the current scope from the context
 /// </summary>
 /// <param name="context">The context</param>
 /// <returns>The current scope</returns>
 public static Neo4JFilterScope GetNeo4JFilterScope(
     this Neo4JFilterVisitorContext context) =>
 (Neo4JFilterScope)context.GetScope();
Esempio n. 7
0
 /// <inheritdoc />
 protected override Condition HandleListOperation(
     Neo4JFilterVisitorContext context,
     IFilterField field,
     Neo4JFilterScope scope,
     string path) =>
 new CompoundCondition(Operator.And);