public ArangoQueryOperation IN(List <object> list, ArangoQueryOperation aql)
        {
            var etom = new Etom();

            etom.Type = AQL.IN;

            var expression = new StringBuilder("[");

            for (int i = 0; i < list.Count; i++)
            {
                expression.Append(ToString(list[i]));

                if (i < (list.Count - 1))
                {
                    expression.Append(", ");
                }
            }

            expression.Append("]");

            etom.Value    = expression.ToString();
            etom.Children = aql.ExpressionTree;

            return(AddEtom(etom));
        }
        public ArangoQueryOperation Object(ArangoQueryOperation aql)
        {
            var etom = new Etom();

            etom.Type     = AQL.Object;
            etom.Children = aql.ExpressionTree;

            return(AddEtom(etom));
        }
        public ArangoQueryOperation TO_STRING(ArangoQueryOperation aql)
        {
            var etom = new Etom();

            etom.Type = AQL.TO_STRING;

            etom.Children = aql.ExpressionTree;

            return(AddEtom(etom));
        }
        public ArangoQueryOperation OR(ArangoQueryOperation expression)
        {
            var etom = new Etom();

            etom.Type = AQL.OR;

            etom.Children.AddRange(expression.ExpressionTree);

            return(AddEtom(etom));
        }
        public ArangoQueryOperation IN(string name, ArangoQueryOperation aql)
        {
            var etom = new Etom();

            etom.Type     = AQL.IN;
            etom.Value    = name;
            etom.Children = aql.ExpressionTree;

            return(AddEtom(etom));
        }
        private ArangoQueryOperation AddEtom(Etom etom)
        {
            ExpressionTree.Add(etom);

            var aqo = new ArangoQueryOperation(_cursorOperation, ExpressionTree);

            ExpressionTree.Clear();

            return(aqo);
        }
        /*
         *  standard high level operations
         */

        #region AND

        public ArangoQueryOperation AND(ArangoQueryOperation leftOperand, ArangoOperator conditionOperator, ArangoQueryOperation rightOperand)
        {
            var etom = new Etom();

            etom.Type  = AQL.AND;
            etom.Value = conditionOperator;

            etom.Children.AddRange(leftOperand.ExpressionTree);
            etom.Children.AddRange(rightOperand.ExpressionTree);

            return(AddEtom(etom));
        }
        public ArangoQueryOperation CONTAINS(ArangoQueryOperation text, ArangoQueryOperation search, bool returnIndex)
        {
            var etom = new Etom();

            etom.Type         = AQL.CONTAINS;
            etom.Value        = returnIndex;
            etom.ChildrenList = new List <List <Etom> >();
            etom.ChildrenList.Add(text.ExpressionTree);
            etom.ChildrenList.Add(search.ExpressionTree);

            return(AddEtom(etom));
        }
        public ArangoQueryOperation EDGES(string collection, string vertexId, ArangoEdgeDirection edgeDirection, ArangoQueryOperation aql)
        {
            var etom = new Etom();

            etom.Type = AQL.EDGES;

            var expression = new StringBuilder(collection + ", ");

            // if vertex is valid document ID/handle enclose it with single quotes
            // otherwise it's most probably variable which shouldn't be enclosed
            if (Document.IsId(vertexId))
            {
                expression.Append("'" + vertexId + "'");
            }
            else
            {
                expression.Append(vertexId);
            }

            expression.Append(", '");

            switch (edgeDirection)
            {
            case ArangoEdgeDirection.In:
                expression.Append("inbound");
                break;

            case ArangoEdgeDirection.Out:
                expression.Append("outbound");
                break;

            case ArangoEdgeDirection.Any:
                expression.Append("any");
                break;

            default:
                break;
            }

            expression.Append("'");

            etom.Value    = expression;
            etom.Children = aql.ExpressionTree;

            return(AddEtom(etom));
        }
Exemplo n.º 10
0
 public ArangoQueryOperation CONTAINS(ArangoQueryOperation text, ArangoQueryOperation search)
 {
     return(CONTAINS(text, search, false));
 }