public IExpression In(params IExpression[] expressions) { if (!(this is QueryTypeExpression lhs)) { throw new NotSupportedException(); } var rhs = new QueryTypeExpression(expressions); return(new QueryBinaryExpression(lhs, rhs, BinaryOpType.In)); }
public IExpression In([ItemNotNull] params IExpression[] expressions) { if (!(this is QueryTypeExpression lhs)) { throw new NotSupportedException(); } CBDebug.ItemsMustNotBeNull(WriteLog.To.Query, Tag, nameof(expressions), expressions); var rhs = new QueryTypeExpression(expressions); return(new QueryBinaryExpression(lhs, rhs, BinaryOpType.In)); }
public IExpression Between(IExpression expression1, IExpression expression2) { if (!(this is QueryTypeExpression lhs)) { throw new NotSupportedException(); } var exp1 = GetBetweenExpression(expression1); var exp2 = GetBetweenExpression(expression2); var rhs = new QueryTypeExpression(new[] { exp1, exp2 }); return(new QueryBinaryExpression(lhs, rhs, BinaryOpType.Between)); }
public IExpression Between([NotNull] IExpression expression1, [NotNull] IExpression expression2) { if (!(this is QueryTypeExpression lhs)) { throw new NotSupportedException(); } CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(expression1), expression1); CBDebug.MustNotBeNull(WriteLog.To.Query, Tag, nameof(expression2), expression2); var exp1 = GetBetweenExpression(expression1); var exp2 = GetBetweenExpression(expression2); var rhs = new QueryTypeExpression(new[] { exp1, exp2 }); return(new QueryBinaryExpression(lhs, rhs, BinaryOpType.Between)); }
private static IList EncodeExpressions(IList expressions) { var result = new List <object>(); foreach (var r in expressions) { object jsonObj; var arr = r as IList; if (arr != null) { jsonObj = arr; } else { QueryExpression expr; var str = r as string; if (str != null) { expr = new QueryTypeExpression(str, ExpressionType.KeyPath); } else { expr = r as QueryExpression; if (expr == null) { throw new InvalidOperationException( String.Format(CouchbaseLiteErrorMessage.ExpressionsMustBeIExpressionOrString, "IExpression")); } } jsonObj = expr.ConvertToJSON(); } result.Add(jsonObj); } return(result); }
private static IList EncodeExpressions(IList expressions) { var result = new List <object>(); foreach (var r in expressions) { object jsonObj; var arr = r as IList; if (arr != null) { jsonObj = arr; } else { QueryExpression expr; var str = r as string; if (str != null) { expr = new QueryTypeExpression(str, ExpressionType.KeyPath); } else { expr = r as QueryExpression; if (expr == null) { throw new InvalidOperationException("Expressions must either be IExpression or string"); } } jsonObj = expr.ConvertToJSON(); } result.Add(jsonObj); } return(result); }