Пример #1
0
 internal AqlUpsert(string collectionName, IAqlValue search, IAqlValue insert, UpdateBuilder <T> update)
 {
     _collectionName = collectionName;
     _search         = search;
     _insert         = insert;
     _update         = update;
     _options        = new Dictionary <string, object>();
 }
Пример #2
0
        public UpdateBuilder<T> Inc<TV>(Expression<Func<T, TV>> field, IAqlValue<TV> build)
        {
            var expression = new FieldExpression<T, TV>(field);

            _updates.Add(new AqlUpdateInc(expression.Field, (_fieldname ?? expression.Name), build));

            return this;
        }
Пример #3
0
        public UpdateBuilder<T> Set<TV>(Expression<Func<T, TV>> field, IAqlValue<TV> value)
        {
            var expression = new FieldExpression<T, TV>(field);

            _updates.Add(new AqlUpdateSetValue(expression.Field, value));

            return this;
        }
Пример #4
0
        public AQuery Upsert <T>(string collectionName, IAqlValue search, IAqlValue insert, Action <UpdateBuilder <T> > build)
        {
            var update = new UpdateBuilder <T>();

            build.Invoke(update);

            _queries.Add(new AqlUpsert <T>(collectionName, search, insert, update));

            return(this);
        }
Пример #5
0
 internal AqlSort(IAqlValue field, Direction direction)
 {
     _field     = field;
     _direction = direction;
 }
Пример #6
0
 /// <summary>
 /// SHA1(value)
 /// </summary>
 /// <param name="v">AqlValue</param>
 /// <returns>AqlValue</returns>
 public static AqlFunctionValue <string> SHA1(IAqlValue <string> v)
 {
     return(new("SHA1", v));
 }
Пример #7
0
 /// <summary>
 /// SHA512(value)
 /// </summary>
 /// <param name="v">AqlValue</param>
 /// <returns>AqlValue</returns>
 public static AqlFunctionValue <string> JsonStringify <T>(IAqlValue <T> v)
 {
     return(new("JSON_STRINGIFY", v));
 }
Пример #8
0
 internal AqlCollect(string alias, IAqlValue value)
 {
     _alias = alias;
     _value = value;
 }
Пример #9
0
        public AQuery Insert(string collectionName, IAqlValue definition, AqlInsert.Options options = null)
        {
            _queries.Add(new AqlInsert(collectionName, definition, options));

            return(this);
        }
Пример #10
0
        public AQuery Let(string alias, IAqlValue value)
        {
            _queries.Add(new AqlLet(alias, value));

            return(this);
        }
Пример #11
0
        public AQuery Aggregate(string alias, IAqlValue value)
        {
            _queries.Add(new AqlAggregate(alias, value));

            return(this);
        }
Пример #12
0
 /// <summary>
 /// value1 op value2
 /// </summary>
 /// <param name="v1">Value</param>
 /// <param name="op">Operand</param>
 /// <param name="v2">Value</param>
 /// <typeparam name="T">Type of values</typeparam>
 /// <returns>AqlValue</returns>
 public static AqlOperationValue <T> Op <T>(IAqlValue <T> v1, string op, IAqlValue <T> v2)
 {
     return(new AqlOperationValue <T>(op, v1, v2));
 }
Пример #13
0
 /// <summary>
 /// DOCUMENT(collectionName, documentKey)
 /// </summary>
 /// <param name="c">Collection Name</param>
 /// <param name="k">AqlValue representing documents key</param>
 /// <typeparam name="T">Type of document returned</typeparam>
 /// <returns>AqlValue</returns>
 public static AqlCollectionFunctionValue <T> Document <T>(string c, IAqlValue <string> k)
 {
     return(new AqlCollectionFunctionValue <T>(c, k));
 }
Пример #14
0
 /// <summary>
 /// (condition ? positive : negative)
 /// </summary>
 /// <param name="c">Condition</param>
 /// <param name="p">AqlValue returned when condition is true</param>
 /// <param name="n">AqlValue returned when condition is false</param>
 /// <typeparam name="T">Type of field returned</typeparam>
 /// <returns>AqlValue</returns>
 public static AqlIf <T> If <T>(IAqlExpression <bool> c, IAqlValue <T> p, IAqlValue <T> n)
 {
     return(new AqlIf <T>(c, p, n));
 }
Пример #15
0
 internal AqlFilter(string op, IAqlValue value1, IAqlValue value2)
 {
     _operator = op;
     _value1   = value1;
     _value2   = value2;
 }
Пример #16
0
 /// <summary>
 /// COUNT(value)
 /// </summary>
 /// <param name="v">AqlFieldValue</param>
 /// <typeparam name="T">Type of value returned</typeparam>
 /// <returns>AqlValue</returns>
 public static AqlFunctionValue <int> Count <T>(IAqlValue <T> v) where T : IEnumerable
 {
     return(new AqlFunctionValue <int>("COUNT", v));
 }
Пример #17
0
        public AQuery Upsert <T>(string collectionName, IAqlValue search, IAqlValue insert, UpdateBuilder <T> update)
        {
            _queries.Add(new AqlUpsert <T>(collectionName, search, insert, update));

            return(this);
        }
Пример #18
0
 /// <summary>
 /// RANGE(start, end, step)
 /// </summary>
 /// <param name="start">AqlValue</param>
 /// <param name="end">AqlValue</param>
 /// <param name="step">AqlValue</param>
 /// <returns>AqlValue</returns>
 public static AqlFunctionValue <int> Range(IAqlValue <int> start, IAqlValue <int> end, IAqlValue <int> step)
 {
     return(new AqlFunctionValue <int>("RANGE", start, end, step));
 }
Пример #19
0
        public AQuery Sort(IAqlValue field, AqlSort.Direction direction)
        {
            _queries.Add(new AqlSort(field, direction));

            return(this);
        }
Пример #20
0
 internal AqlInsert(string collectionName, IAqlValue value, Options options = null)
 {
     _collectionName = collectionName;
     _value          = value;
     _options        = options;
 }
Пример #21
0
        public AQuery For(string alias, IAqlValue collection)
        {
            _queries.Add(new AqlFor(alias, collection));

            return(this);
        }
Пример #22
0
 public static AqlFilterAnd Between <T>(IAqlValue <T> value, IAqlValue <T> min, IAqlValue <T> max)
 {
     return(And(Gte(value, min), Lte(value, max)));
 }
Пример #23
0
 public AqlUpdateInc(string field, string fieldname, IAqlValue value)
 {
     _field     = field;
     _fieldname = fieldname;
     _value     = value;
 }
Пример #24
0
 public static AqlFilter Nin <T>(IAqlValue <T> value1, AqlArrayValue <T> value2)
 {
     return(new AqlFilter("NOT IN", value1, value2));
 }
Пример #25
0
 public AqlUpdateSetValue(string field, IAqlValue value)
 {
     _field = field;
     _value = value;
 }
Пример #26
0
 public static AqlFilter Nin <T>(IAqlValue <T> value1, IAqlValue <IEnumerable <T> > value2)
 {
     return(new AqlFilter("NOT IN", value1, value2));
 }
Пример #27
0
 /// <summary>
 /// SHA512(value)
 /// </summary>
 /// <param name="v">AqlValue</param>
 /// <returns>AqlValue</returns>
 public static AqlFunctionValue <T> JsonParse <T>(IAqlValue <string> v)
 {
     return(new("JSON_PARSE", v));
 }
Пример #28
0
 public static AqlFilter Eq <T>(IAqlValue <T> value1, IAqlValue <T> value2)
 {
     return(new AqlFilter("==", value1, value2));
 }
Пример #29
0
 internal AqlAggregate(string alias, IAqlValue value)
 {
     _alias = alias;
     _value = value;
 }
 internal AqlCollectionFunctionValue(string collection, IAqlValue value)
 {
     _collection = collection;
     _value      = value;
 }