Beispiel #1
0
            Sorter Parse_Array(NodeValue jsonValue)
            {
                Sorter result = new Sorter();

                foreach (object element in (System.Collections.IEnumerable)jsonValue.Value)
                {
                    NodeValue item = new NodeValue(element);
                    if (item.Type != NodeValueTypes.String)
                    {
                        continue;
                    }
                    string value = item.Value as string;
                    if (string.IsNullOrEmpty(value))
                    {
                        continue;
                    }
                    if (!Filter_Name(value))
                    {
                        continue;
                    }
                    if (value.IndexOf(' ') > 0)
                    {
                        result._values[value] = WrapValue(null);
                    }
                    else
                    {
                        string[] pair = value.Split(' ');
                        if (pair.Length == 2)
                        {
                            result._values[pair[0]] = WrapValue(new NodeValue(pair[1]));
                        }
                    }
                }
                return(result);
            }
Beispiel #2
0
            Define Parse(NodeValue jsonValue, Define define = null)
            {
                if (jsonValue == null)
                {
                    return(define ?? new Define());
                }

                if (jsonValue.Type == NodeValueTypes.Array)
                {
                    return(Parse_Array(jsonValue));
                }
                else if (jsonValue.Type == NodeValueTypes.Dictionary)
                {
                    Define refer = new Define();
                    Parse_Dictionary(refer, jsonValue);
                    return(refer);
                }
                else if (jsonValue.Type == NodeValueTypes.Object)
                {
                    Define refer = new Define();
                    Parse_Object(refer, jsonValue);
                    return(refer);
                }
                else if (jsonValue.Type == NodeValueTypes.String)
                {
                    return(Parse_String(jsonValue));
                }
                return(new Define());
            }
Beispiel #3
0
 Refer Parse(NodeValue jsonValue)
 {
     if (jsonValue == null)
     {
         return(new Refer());
     }
     if (jsonValue.Type == NodeValueTypes.Array)
     {
         return(Parse_Array(jsonValue));
     }
     else if (jsonValue.Type == NodeValueTypes.Dictionary)
     {
         Refer refer = new Refer();
         Parse_Dictionary(refer, jsonValue);
         return(refer);
     }
     else if (jsonValue.Type == NodeValueTypes.Object)
     {
         Refer refer = new Refer();
         Parse_Object(refer, jsonValue);
         return(refer);
     }
     else if (jsonValue.Type == NodeValueTypes.String)
     {
         return(Parse_String(jsonValue));
     }
     return(new Refer());
 }
Beispiel #4
0
 string WrapValue(NodeValue jsonValue)
 {
     if (jsonValue == null || jsonValue.Type == NodeValueTypes.Null)
     {
         return("asc");
     }
     else if (jsonValue.Type == NodeValueTypes.Number)
     {
         return(TypeExtensions.Convert <long>(jsonValue.Value, 0) == 0 ? "asc" : "desc");
     }
     else if (jsonValue.Type == NodeValueTypes.String)
     {
         string value = (string)jsonValue.Value;
         if (string.IsNullOrEmpty(value) || value.StartsWith("asc", StringComparison.OrdinalIgnoreCase))
         {
             return("asc");
         }
         return("desc");
     }
     else if (jsonValue.Type == NodeValueTypes.Boolean)
     {
         return(((bool)jsonValue.Value) ? "desc" : "asc");
     }
     else
     {
         return("asc");
     }
 }
Beispiel #5
0
            /// <summary>
            /// 解析
            /// </summary>
            /// <param name="value">仅支持string[]、string、{}、object、string(json)</param>
            /// <returns></returns>
            public Refer Parse(object value)
            {
                Refer result = value as Refer;

                if (result != null)
                {
                    return(result);
                }
                return(Parse(NodeValue.As(value)));
            }
Beispiel #6
0
            /// <summary>
            /// 解析
            /// </summary>
            /// <param name="value">仅支持string[]、string、{}、object、string(json)</param>
            /// <returns></returns>
            public Define Parse(object value)
            {
                Define result = value as Define;

                if (result != null)
                {
                    return(result);
                }
                return(Parse(NodeValue.As(value)));
            }
Beispiel #7
0
 void Next_Array(Condition parent, NodeValue jsonValue, NodeValueTypes[] types)
 {
     foreach (object item in (System.Collections.IEnumerable)jsonValue.Value)
     {
         NodeValue json = NodeValue.As(item);
         if (System.Array.IndexOf(types, json.Type) > -1)
         {
             Next(parent, json);
         }
     }
 }
Beispiel #8
0
            /// <summary>
            /// 解析
            /// </summary>
            /// <param name="value"></param>
            /// <returns></returns>
            public Condition Parse(object value)
            {
                Condition result = value as Condition;

                if (result != null)
                {
                    return(result);
                }
                result = new Condition("$root", ConditionTypes.Root);
                Parse(result, NodeValue.As(value));
                return(result);
            }
Beispiel #9
0
            bool Check_Pair_Field(Condition pair, NodeValue jsonValue)
            {
                switch (jsonValue.Type)
                {
                case NodeValueTypes.Array: {
                    pair.Children.Add(new Condition("$in", ConditionTypes.Logical, jsonValue.Value));
                    return(true);
                }

                case NodeValueTypes.Dictionary: {
                    Next_Dictionary(pair, jsonValue);
                    return(pair.Children.Count > 0);
                }

                case NodeValueTypes.Object: {
                    Next_Object(pair, jsonValue);
                    return(pair.Children.Count > 0);
                }

                case NodeValueTypes.String: {
                    string value = jsonValue.Value as string;
                    if (string.IsNullOrEmpty(value))
                    {
                        return(false);
                    }
                    if (value[0] == '[')
                    {
                        if (Check_Pair_Field(pair, new NodeValue(JSON.Parse(value))))
                        {
                            return(true);
                        }
                    }
                    if (value[0] == '{')
                    {
                        if (Check_Pair_Field(pair, new NodeValue(JSON.Parse(value))))
                        {
                            return(true);
                        }
                    }
                    pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                    return(true);
                }

                case NodeValueTypes.Null: {
                    return(false);
                }

                default: {
                    pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                    return(true);
                }
                }
            }
Beispiel #10
0
 void Parse_Object(Define define, NodeValue jsonValue)
 {
     //string[] pairs = new string[5];
     //foreach (System.Reflection.PropertyInfo propertyInfo in jsonValue.ValueType.GetProperties()) {
     //    string key = propertyInfo.Name;
     //    if (string.Equals(key, "by", StringComparison.OrdinalIgnoreCase)) {
     //        Parse_Pairs(pairs, 3, new JsonValue(propertyInfo.GetValue(jsonValue.Value, new object[0])));
     //    } else {
     //        pairs[0] = key;
     //        Parse_Pairs(pairs, 1, new JsonValue(propertyInfo.GetValue(jsonValue.Value, new object[0])));
     //    }
     //}
     //define.Add(Create_Pairs(pairs));
 }
Beispiel #11
0
            Refer Parse_String(NodeValue jsonValue)
            {
                string value = jsonValue.Value as string;

                if (string.IsNullOrEmpty(value))
                {
                    return(new Refer());
                }
                if (value[0] == '[' || value[0] == '{')
                {
                    return(Parse(JSON.Parse(value)));
                }
                return(new Refer());
            }
Beispiel #12
0
        /// <summary>
        /// 预处理:字段值
        /// </summary>
        /// <param name="builder">构造缓存。</param>
        /// <param name="name">字段名称。</param>
        /// <param name="value">字段值。</param>
        /// <param name="i">顺序。</param>
        /// <returns>返回是否过滤。</returns>
        protected virtual bool PreFieldValue(System.Text.StringBuilder builder, string name, object value, ref int i)
        {
            var p = value as CommandParameter;

            NoSQL.NodeValue nodeValue = new NoSQL.NodeValue(p == null ? value : p.Value);
            if (nodeValue.Type == NoSQL.NodeValueTypes.Dictionary)
            {
                return(PreFieldValue_Dictionary(builder, name, nodeValue, ref i));
            }
            if (nodeValue.Type == NoSQL.NodeValueTypes.String)
            {
                return(PreFieldValue_String(builder, name, nodeValue, ref i));
            }
            return(false);
        }
Beispiel #13
0
 void Next(Condition parent, NodeValue jsonValue)
 {
     if (jsonValue.Type == NodeValueTypes.Dictionary)
     {
         Next_Dictionary(parent, jsonValue);
     }
     else if (jsonValue.Type == NodeValueTypes.Object)
     {
         Next_Object(parent, jsonValue);
     }
     else if (jsonValue.Type == NodeValueTypes.String)
     {
         Next_String(parent, jsonValue);
     }
 }
Beispiel #14
0
            Sorter Parse_Object(NodeValue jsonValue)
            {
                Sorter result = new Sorter();

                foreach (System.Reflection.PropertyInfo propertyInfo in jsonValue.ValueType.GetProperties())
                {
                    string key = propertyInfo.Name;
                    if (!Filter_Name(key))
                    {
                        continue;
                    }
                    NodeValue value = new NodeValue(propertyInfo.GetValue(jsonValue.Value, new object[0]));
                    result._values[key] = WrapValue(value);
                }
                return(result);
            }
Beispiel #15
0
 void Parse_Dictionary(Define define, NodeValue jsonValue)
 {
     //string[] pairs = new string[5];
     //foreach (object item in (System.Collections.IEnumerable)jsonValue.Value) {
     //    string key = FastWrapper.Get(item, "Key") as string;
     //    if (string.IsNullOrEmpty(key))
     //        continue;
     //    object value = FastWrapper.Get(item, "Value");
     //    if (string.Equals(key, "by", StringComparison.OrdinalIgnoreCase)) {
     //        Parse_Pairs(pairs, 3, new JsonValue(value));
     //    } else {
     //        pairs[0] = key;
     //        Parse_Pairs(pairs, 1, new JsonValue(value));
     //    }
     //}
     //define.Add(Create_Pairs(pairs));
 }
Beispiel #16
0
            Define Parse_String(NodeValue jsonValue, Define define = null)
            {
                string value = jsonValue.Value as string;

                if (string.IsNullOrEmpty(value))
                {
                    return(define ?? new Define());
                }
                //if (value[0] == '[' || value[0] == '{') {
                //    return Parse(JSON.Parse(value), define);
                //}
                if (define == null)
                {
                    define = new Define();
                }
                Parse_String(define, value);
                return(define);
            }
Beispiel #17
0
 void Next_Object(Condition parent, NodeValue jsonValue)
 {
     foreach (System.Reflection.PropertyInfo propertyInfo in jsonValue.ValueType.GetProperties())
     {
         string         key  = propertyInfo.Name;
         ConditionTypes type = GetType(key);
         if (type == ConditionTypes.Root)
         {
             continue;
         }
         object    value = propertyInfo.GetValue(jsonValue.Value, new object[0]);
         Condition pair  = new Condition(key, type);
         if (Check_Pair(pair, value))
         {
             parent.Children.Add(pair);
         }
     }
 }
Beispiel #18
0
 void Parse_Object(Refer refer, NodeValue jsonValue)
 {
     string[] pairs = new string[5];
     foreach (System.Reflection.PropertyInfo propertyInfo in jsonValue.ValueType.GetProperties())
     {
         string key = propertyInfo.Name;
         if (string.Equals(key, "by", StringComparison.OrdinalIgnoreCase))
         {
             Parse_Pairs(pairs, 3, new NodeValue(propertyInfo.GetValue(jsonValue.Value, new object[0])));
         }
         else
         {
             pairs[0] = key;
             Parse_Pairs(pairs, 1, new NodeValue(propertyInfo.GetValue(jsonValue.Value, new object[0])));
         }
     }
     refer.Add(Create_Pairs(pairs));
 }
Beispiel #19
0
            void Next_String(Condition parent, NodeValue jsonValue)
            {
                string value = jsonValue.Value as string;

                if (string.IsNullOrEmpty(value))
                {
                    return;
                }
                if (value[0] == '[' || value[0] == '{')
                {
                    Parse(parent, JSON.Parse(value));
                }
                if (value[0] == '$' || value[0] == '!')
                {
                    value = "{ \"" + value + "\":null }";
                    Parse(parent, JSON.Parse(value));
                }
            }
Beispiel #20
0
            bool Check_Pair(Condition pair, object value)
            {
                NodeValue jsonValue = new NodeValue(value);

                if (pair.Type == ConditionTypes.Field)
                {
                    return(Check_Pair_Field(pair, jsonValue));
                }
                else if (pair.Type == ConditionTypes.Logical)
                {
                    bool b = Check_Pair_Logical(pair, jsonValue);
                    if (b && pair._name[0] != '$')
                    {
                        pair._name = "$" + pair._name;
                    }
                    return(b);
                }
                return(false);
            }
Beispiel #21
0
            Define Parse_Array(NodeValue jsonValue)
            {
                Define result = new Define();

                foreach (object element in (System.Collections.IEnumerable)jsonValue.Value)
                {
                    NodeValue item = new NodeValue(element);
                    bool      b    = true;
lb_Retury:
                    if (item.Type == NodeValueTypes.Object)
                    {
                        Parse_Object(result, item);
                        continue;
                    }
                    if (item.Type == NodeValueTypes.Dictionary)
                    {
                        Parse_Dictionary(result, item);
                        continue;
                    }
                    if (!b)
                    {
                        continue;
                    }
                    if (item.Type == NodeValueTypes.String)
                    {
                        string text = item.Value as string;
                        if (string.IsNullOrEmpty(text))
                        {
                            continue;
                        }
                        Parse_String(item, result);
                        if (text[0] == '[' || text[0] == '{')
                        {
                            item = new NodeValue(JSON.Parse(text));
                            b    = false;
                            goto lb_Retury;
                        }
                        continue;
                    }
                }
                return(result);
            }
Beispiel #22
0
            Sorter Parse_String(NodeValue jsonValue)
            {
                string value = jsonValue.Value as string;

                if (string.IsNullOrEmpty(value))
                {
                    return(new Sorter());
                }
                if (value[0] == '[' || value[0] == '{')
                {
                    return(Parse(JSON.Parse(value)));
                }
                Sorter result = new Sorter();

                if (Filter_Name(value))
                {
                    result._values.Add(value, WrapValue(null));
                }
                return(result);
            }
Beispiel #23
0
            Sorter Parse_Dictionary(NodeValue jsonValue)
            {
                Sorter result = new Sorter();

                foreach (object item in (System.Collections.IEnumerable)jsonValue.Value)
                {
                    string key = FastWrapper.Get(item, "Key") as string;
                    if (string.IsNullOrEmpty(key))
                    {
                        continue;
                    }
                    if (!Filter_Name(key))
                    {
                        continue;
                    }

                    NodeValue value = new NodeValue(FastWrapper.Get(item, "Value"));
                    result._values[key] = WrapValue(value);
                }
                return(result);
            }
Beispiel #24
0
 void Next_Dictionary(Condition parent, NodeValue jsonValue)
 {
     foreach (object item in (System.Collections.IEnumerable)jsonValue.Value)
     {
         string key = FastWrapper.Get(item, "Key") as string;
         if (string.IsNullOrEmpty(key))
         {
             continue;
         }
         ConditionTypes type = GetType(key);
         if (type == ConditionTypes.Root)
         {
             continue;
         }
         object    value = FastWrapper.Get(item, "Value");
         Condition pair  = new Condition(key, type);
         if (Check_Pair(pair, value))
         {
             parent.Children.Add(pair);
         }
     }
 }
Beispiel #25
0
 void Parse_Dictionary(Refer refer, NodeValue jsonValue)
 {
     string[] pairs = new string[5];
     foreach (object item in (System.Collections.IEnumerable)jsonValue.Value)
     {
         string key = FastWrapper.Get(item, "Key") as string;
         if (string.IsNullOrEmpty(key))
         {
             continue;
         }
         object value = FastWrapper.Get(item, "Value");
         if (string.Equals(key, "by", StringComparison.OrdinalIgnoreCase))
         {
             Parse_Pairs(pairs, 3, new NodeValue(value));
         }
         else
         {
             pairs[0] = key;
             Parse_Pairs(pairs, 1, new NodeValue(value));
         }
     }
     refer.Add(Create_Pairs(pairs));
 }
Beispiel #26
0
 Sorter Parse(NodeValue jsonValue)
 {
     if (jsonValue == null)
     {
         return(new Sorter());
     }
     if (jsonValue.Type == NodeValueTypes.Array)
     {
         return(Parse_Array(jsonValue));
     }
     else if (jsonValue.Type == NodeValueTypes.Dictionary)
     {
         return(Parse_Dictionary(jsonValue));
     }
     else if (jsonValue.Type == NodeValueTypes.Object)
     {
         return(Parse_Object(jsonValue));
     }
     else if (jsonValue.Type == NodeValueTypes.String)
     {
         return(Parse_String(jsonValue));
     }
     return(new Sorter());
 }
Beispiel #27
0
 void Parse(Condition parent, object value)
 {
     Next(parent, NodeValue.As(value));
 }
Beispiel #28
0
        /// <summary>
        /// 预处理:字段值-文本
        /// </summary>
        /// <param name="builder">构造缓存。</param>
        /// <param name="name">字段名称。</param>
        /// <param name="nodeValue">值包装</param>
        /// <param name="i">顺序。</param>
        /// <returns>返回是否过滤。</returns>
        protected virtual bool PreFieldValue_String(System.Text.StringBuilder builder, string name, NoSQL.NodeValue nodeValue, ref int i)
        {
            string text = ((string)nodeValue.Value)?.Trim();

            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }
            if (text.StartsWith("{") && text.EndsWith("}"))
            {
                return(PreFieldValue_Dictionary(builder, name, new NoSQL.NodeValue(JSON.Parse(text)), ref i));
            }
            return(false);
        }
Beispiel #29
0
            bool Parse_Pairs(string[] pairs, int offset, NodeValue jsonValue)
            {
                bool b = true;

lb_Retury:
                if (jsonValue.Type == NodeValueTypes.Object)
                {
                    foreach (System.Reflection.PropertyInfo propertyInfo in jsonValue.ValueType.GetProperties())
                    {
                        string key   = propertyInfo.Name;
                        object value = propertyInfo.GetValue(jsonValue.Value, new object[0]);
                        pairs[offset]     = key;
                        pairs[offset + 1] = value as string;
                        goto lb_Result;
                    }
                    return(false);
                }
                if (jsonValue.Type == NodeValueTypes.Dictionary)
                {
                    foreach (object item in (System.Collections.IEnumerable)jsonValue.Value)
                    {
                        string key = FastWrapper.Get(item, "Key") as string;
                        if (string.IsNullOrEmpty(key))
                        {
                            continue;
                        }
                        object value = FastWrapper.Get(item, "Value");
                        pairs[offset]     = key;
                        pairs[offset + 1] = value as string;
                        goto lb_Result;
                    }
                    return(false);
                }
                if (jsonValue.Type == NodeValueTypes.Array)
                {
                    int n = 0;
                    foreach (object element in (System.Collections.IEnumerable)jsonValue.Value)
                    {
                        pairs[offset + n] = element as string;
                        n++;
                        if (n == 2)
                        {
                            goto lb_Result;
                        }
                    }
                    return(false);
                }
                if (!b)
                {
                    return(false);
                }
                if (jsonValue.Type == NodeValueTypes.String)
                {
                    string text = jsonValue.Value as string;
                    if (string.IsNullOrEmpty(text))
                    {
                        return(false);
                    }
                    if (text[0] == '[' || text[0] == '{')
                    {
                        jsonValue = new NodeValue(JSON.Parse(text));
                        b         = false;
                        goto lb_Retury;
                    }
                }
lb_Result:
                return(!string.IsNullOrEmpty(pairs[offset]) && !string.IsNullOrEmpty(pairs[offset + 1]));
            }
Beispiel #30
0
            bool Check_Pair_Logical(Condition pair, NodeValue jsonValue)
            {
                switch (pair.Name[0] == '$' ? pair.Name.Substring(1).ToLower() : pair.Name)
                {
                    #region eq
                case "=":
                case "==":
                case "eq": {
                    if (jsonValue.IsValue)
                    {
                        pair._name  = "eq";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                    #endregion
                    #region in notin
                case "in": {
                    if (jsonValue.Type == NodeValueTypes.Array && jsonValue.Length > 0)
                    {
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                case "!in":
                case "nin":
                case "notin": {
                    if (jsonValue.Type == NodeValueTypes.Array && jsonValue.Length > 0)
                    {
                        pair._name  = "notin";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                    #endregion
                    #region > <
                case ">":
                case "gt": {
                    if (jsonValue.IsValue)
                    {
                        pair._name  = "gt";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                case "<":
                case "lt": {
                    if (jsonValue.IsValue)
                    {
                        pair._name  = "lt";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                    #endregion
                    #region !=
                case "!=":
                case "<>":
                case "neq":
                case "noteq":
                case "nq":
                case "!eq": {
                    if (jsonValue.IsValue)
                    {
                        pair._name  = "noteq";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                    #endregion
                    #region >= <=
                case ">=":
                case "gteq":
                case "gte": {
                    if (jsonValue.IsValue)
                    {
                        pair._name  = "gteq";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                case "<=":
                case "lteq":
                case "lte": {
                    if (jsonValue.IsValue)
                    {
                        pair._name  = "lteq";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                    #endregion
                    #region null
                case "nul":
                case "nl":
                case "null": {
                    pair._name = "null";
                    return(true);
                }

                    #endregion
                    #region null
                case "notnull":
                case "!nul":
                case "!nl":
                case "!null": {
                    pair._name = "notnull";
                    return(true);
                }

                    #endregion
                    #region && ||
                case "&&":
                case "and": {
                    pair._name = "and";
                    if (jsonValue.Type == NodeValueTypes.Dictionary)
                    {
                        Next_Dictionary(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    if (jsonValue.Type == NodeValueTypes.Object)
                    {
                        Next_Object(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    if (jsonValue.Type == NodeValueTypes.Array)
                    {
                        Next_Array(pair, jsonValue, new NodeValueTypes[] { NodeValueTypes.Object, NodeValueTypes.Dictionary });
                        pair.Children.IsArray = true;
                        return(pair.Children.Count > 0);
                    }
                    return(false);
                }

                case "||":
                case "or": {
                    pair._name = "or";
                    if (jsonValue.Type == NodeValueTypes.Dictionary)
                    {
                        Next_Dictionary(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    if (jsonValue.Type == NodeValueTypes.Object)
                    {
                        Next_Object(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    if (jsonValue.Type == NodeValueTypes.Array)
                    {
                        Next_Array(pair, jsonValue, new NodeValueTypes[] { NodeValueTypes.Object, NodeValueTypes.Dictionary });
                        pair.Children.IsArray = true;
                        return(pair.Children.Count > 0);
                    }

                    return(false);
                }

                    #endregion
                    #region not !
                case "!":
                case "not": {
                    pair._name = "not";
                    Next(pair, jsonValue);
                    return(pair.Children.Count > 0);
                }

                    #endregion
                    #region like start end
                case "like": {
                    if (jsonValue.Type == NodeValueTypes.String)
                    {
                        pair._name  = "like";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                case "start": {
                    if (jsonValue.Type == NodeValueTypes.String)
                    {
                        pair._name  = "start";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                case "end": {
                    if (jsonValue.Type == NodeValueTypes.String)
                    {
                        pair._name  = "end";
                        pair._value = jsonValue.Value;
                        return(true);
                    }
                    return(false);
                }

                    #endregion
                    #region min max count sum
                case "min": {
                    if (jsonValue.Type == NodeValueTypes.Number)
                    {
                        pair._name = "min";
                        pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                        return(true);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Dictionary)
                    {
                        pair._name = "min";
                        Next_Dictionary(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Object)
                    {
                        pair._name = "min";
                        Next_Object(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    return(false);
                }

                case "max": {
                    if (jsonValue.Type == NodeValueTypes.Number)
                    {
                        pair._name = "max";
                        pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                        return(true);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Dictionary)
                    {
                        pair._name = "max";
                        Next_Dictionary(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Object)
                    {
                        pair._name = "max";
                        Next_Object(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    return(false);
                }

                case "count": {
                    if (jsonValue.Type == NodeValueTypes.Number)
                    {
                        pair._name = "count";
                        pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                        return(true);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Dictionary)
                    {
                        pair._name = "count";
                        Next_Dictionary(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Object)
                    {
                        pair._name = "count";
                        Next_Object(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    return(false);
                }

                case "sum": {
                    if (jsonValue.Type == NodeValueTypes.Number)
                    {
                        pair._name = "sum";
                        pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                        return(true);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Dictionary)
                    {
                        pair._name = "sum";
                        Next_Dictionary(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    else if (jsonValue.Type == NodeValueTypes.Object)
                    {
                        pair._name = "sum";
                        Next_Object(pair, jsonValue);
                        return(pair.Children.Count > 0);
                    }
                    return(false);
                }

                    #endregion
                    #region # ref
                case "#":
                case "ref": {
                    if (jsonValue.Type == NodeValueTypes.String)
                    {
                        string text = (string)jsonValue.Value;
                        if (string.IsNullOrEmpty(text))
                        {
                            return(false);
                        }
                        pair._name  = "ref";
                        pair._value = text;
                        //pair.Children.Add(new Condition("$eq", ConditionTypes.Logical, jsonValue.Value));
                        return(true);
                    }
                    return(false);
                }
                    #endregion

                    #region other commands
                    //case "min": {

                    //    }
                    //case "max": {
                    //    }
                    //case "count": {
                    //    }
                    //case "len": {
                    //    }
                    //case "lenb": {
                    //    }
                    //case "group": {
                    //    }


                    //case "reg":
                    //case "regex": {
                    //    }
                    //
                    #endregion
                }
                return(false);
            }