Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 48 lines (42 sloc) 1.135 kb
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
1 using System;
4526a65 @nberardi some much needed refactoring of the schema
nberardi authored
2 using Apache.Cassandra;
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
3 using FluentCassandra.Types;
4
5 namespace FluentCassandra
6 {
7 public class CassandraColumnSchema
8 {
2f86912 @nberardi all tests now compile, so the new genericless types have been provide…
nberardi authored
9 public CassandraColumnSchema()
10 {
d576460 @nberardi made the type system more robus to support parsing of complex types f…
nberardi authored
11 NameType = CassandraType.BytesType;
12 ValueType = CassandraType.BytesType;
2f86912 @nberardi all tests now compile, so the new genericless types have been provide…
nberardi authored
13 }
14
d576460 @nberardi made the type system more robus to support parsing of complex types f…
nberardi authored
15 public CassandraColumnSchema(ColumnDef def, CassandraType columnNameType)
4526a65 @nberardi some much needed refactoring of the schema
nberardi authored
16 {
17 NameType = columnNameType;
f3bc872 @nberardi moved around some methods because they were on the wrong object
nberardi authored
18 Name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(def.Name, columnNameType);
19 ValueType = CassandraType.GetCassandraType(def.Validation_class);
4526a65 @nberardi some much needed refactoring of the schema
nberardi authored
20 }
21
d576460 @nberardi made the type system more robus to support parsing of complex types f…
nberardi authored
22 private CassandraObject _name;
23 public CassandraObject Name
2f86912 @nberardi all tests now compile, so the new genericless types have been provide…
nberardi authored
24 {
25 get { return _name; }
26 set
27 {
f3bc872 @nberardi moved around some methods because they were on the wrong object
nberardi authored
28 _name = value.GetValue(NameType);
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
29 }
30 }
31
d576460 @nberardi made the type system more robus to support parsing of complex types f…
nberardi authored
32 public CassandraType NameType { get; set; }
33 public CassandraType ValueType { get; set; }
ea9226f @nberardi added support for CQL 3 and selecting the CQL version
nberardi authored
34
35 public static implicit operator ColumnDef(CassandraColumnSchema schema)
36 {
37 return new ColumnDef {
38 Name = schema.Name.ToBigEndian(),
39 Validation_class = schema.ValueType.DatabaseType
40 };
41 }
42
43 public static implicit operator CassandraColumnSchema(ColumnDef def)
44 {
45 return new CassandraColumnSchema(def, CassandraType.BytesType);
46 }
e1b11ad @nberardi [breaking change] with recent changes in the Cassandra API and the ne…
nberardi authored
47 }
48 }
Something went wrong with that request. Please try again.