コード例 #1
0
 public static string Render(this AstBinaryOperator @operator)
 {
     return(@operator switch
     {
         AstBinaryOperator.ArrayElemAt => "$arrayElemAt",
         AstBinaryOperator.ATan2 => "$atan2",
         AstBinaryOperator.Cmp => "$cmp",
         AstBinaryOperator.Divide => "$divide",
         AstBinaryOperator.Eq => "$eq",
         AstBinaryOperator.Gt => "$gt",
         AstBinaryOperator.Gte => "$gte",
         AstBinaryOperator.IfNull => "$ifNull",
         AstBinaryOperator.In => "$in",
         AstBinaryOperator.Log => "$log",
         AstBinaryOperator.Lt => "$lt",
         AstBinaryOperator.Lte => "$lte",
         AstBinaryOperator.Mod => "$mod",
         AstBinaryOperator.Ne => "$ne",
         AstBinaryOperator.Pow => "$pow",
         AstBinaryOperator.Round => "$round",
         AstBinaryOperator.SetDifference => "$setDifference",
         AstBinaryOperator.SetIsSubset => "$setIsSubset",
         AstBinaryOperator.Split => "$split",
         AstBinaryOperator.StrCaseCmp => "$strcasecmp",
         AstBinaryOperator.Subtract => "$subtract",
         AstBinaryOperator.Trunc => "$trunc",
         _ => throw new InvalidOperationException($"Unexpected binary operator: {@operator}.")
     });
コード例 #2
0
 public AstBinaryExpression(AstBinaryOperator @operator, AstExpression arg1, AstExpression arg2)
 {
     _operator = @operator;
     _arg1     = Ensure.IsNotNull(arg1, nameof(arg1));
     _arg2     = Ensure.IsNotNull(arg2, nameof(arg2));
 }