コード例 #1
0
ファイル: Helper.cs プロジェクト: 7digital/fluentcassandra
        public static FluentSuperColumn ConvertSuperColumnToFluentCounterSuperColumn(CounterSuperColumn col, CassandraColumnFamilySchema schema = null)
        {
            var superColSchema = new CassandraColumnSchema {
                Name = col.Name
            };

            if (schema != null)
                superColSchema = new CassandraColumnSchema {
                    NameType = schema.SuperColumnNameType,
                    Name = CassandraObject.GetTypeFromDatabaseValue(col.Name, schema.SuperColumnNameType),
                    ValueType = schema.ColumnNameType
                };

            var superCol = new FluentSuperColumn(superColSchema) {
                ColumnName = CassandraObject.GetTypeFromDatabaseValue(col.Name, superColSchema.NameType)
            };

            foreach (var xcol in col.Columns)
                superCol.Columns.Add(ConvertColumnToFluentCounterColumn(xcol, schema));

            return superCol;
        }
コード例 #2
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.Struct)
                    {
                        Column = new Column();
                        Column.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.Struct)
                    {
                        Super_column = new SuperColumn();
                        Super_column.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.Struct)
                    {
                        Counter_column = new CounterColumn();
                        Counter_column.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 4:
                    if (field.Type == TType.Struct)
                    {
                        Counter_super_column = new CounterSuperColumn();
                        Counter_super_column.Read(iprot);
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #3
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.Struct) {
           Column = new Column();
           Column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Super_column = new SuperColumn();
           Super_column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Struct) {
           Counter_column = new CounterColumn();
           Counter_column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 4:
         if (field.Type == TType.Struct) {
           Counter_super_column = new CounterSuperColumn();
           Counter_super_column.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }