コード例 #1
0
        private static Cassandra.IndexExpression VisitRelationalExpression(BinaryExpression exp)
        {
            Cassandra.IndexExpression indexExpression;

            var columnName = GetColumnName(exp.Left);
            var value      = CassandraObject.GetCassandraObjectFromObject(Expression.Lambda(exp.Right).Compile().DynamicInvoke(), CassandraType.BytesType);

            indexExpression = new Cassandra.IndexExpression {
                Column_name = columnName.ToBigEndian(),
                Value       = value.ToBigEndian()
            };

            switch (exp.NodeType)
            {
            case ExpressionType.Equal: indexExpression.Op = Cassandra.IndexOperator.EQ; break;

            case ExpressionType.GreaterThan: indexExpression.Op = Cassandra.IndexOperator.GT; break;

            case ExpressionType.GreaterThanOrEqual: indexExpression.Op = Cassandra.IndexOperator.GTE; break;

            case ExpressionType.LessThan: indexExpression.Op = Cassandra.IndexOperator.LT; break;

            case ExpressionType.LessThanOrEqual: indexExpression.Op = Cassandra.IndexOperator.LTE; break;

            default:
                throw new NotSupportedException(exp.NodeType.ToString() + " is not a supported relational criteria.");
            }

            return(indexExpression);
        }
コード例 #2
0
ファイル: KeyRange.cs プロジェクト: kenangell/fluentcassandra
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           Start_key = iprot.ReadBinary();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.String) {
           End_key = iprot.ReadBinary();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.String) {
           Start_token = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.String) {
           End_token = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 6:
         if (field.Type == TType.List) {
           {
             Row_filter = new List<IndexExpression>();
             TList _list16 = iprot.ReadListBegin();
             for( int _i17 = 0; _i17 < _list16.Count; ++_i17)
             {
               IndexExpression _elem18 = new IndexExpression();
               _elem18 = new IndexExpression();
               _elem18.Read(iprot);
               Row_filter.Add(_elem18);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 5:
         if (field.Type == TType.I32) {
           Count = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
コード例 #3
0
		private static Cassandra.IndexExpression VisitRelationalExpression(BinaryExpression exp)
		{
			Cassandra.IndexExpression indexExpression;

			var columnName = GetColumnName(exp.Left);
			var value = CassandraObject.GetCassandraObjectFromObject(Expression.Lambda(exp.Right).Compile().DynamicInvoke(), CassandraType.BytesType);

			indexExpression = new Cassandra.IndexExpression {
				Column_name = columnName.ToBigEndian(),
				Value = value.ToBigEndian()
			};

			switch (exp.NodeType)
			{
				case ExpressionType.Equal: indexExpression.Op = Cassandra.IndexOperator.EQ; break;
				case ExpressionType.GreaterThan: indexExpression.Op = Cassandra.IndexOperator.GT; break;
				case ExpressionType.GreaterThanOrEqual: indexExpression.Op = Cassandra.IndexOperator.GTE; break;
				case ExpressionType.LessThan: indexExpression.Op = Cassandra.IndexOperator.LT; break;
				case ExpressionType.LessThanOrEqual: indexExpression.Op = Cassandra.IndexOperator.LTE; break;

				default:
					throw new NotSupportedException(exp.NodeType.ToString() + " is not a supported relational criteria.");
			}

			return indexExpression;
		}
コード例 #4
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.List) {
           {
             Expressions = new List<IndexExpression>();
             TList _list12 = iprot.ReadListBegin();
             for( int _i13 = 0; _i13 < _list12.Count; ++_i13)
             {
               IndexExpression _elem14 = new IndexExpression();
               _elem14 = new IndexExpression();
               _elem14.Read(iprot);
               Expressions.Add(_elem14);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.String) {
           Start_key = iprot.ReadBinary();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.I32) {
           Count = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }