public static FluentSuperColumn ConvertSuperColumnToFluentSuperColumn(SuperColumn col, CassandraColumnFamilySchema schema) { var superColSchema = new CassandraColumnSchema { Name = col.Name }; if (schema != null) { superColSchema = new CassandraColumnSchema { NameType = schema.SuperColumnNameType, Name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, schema.SuperColumnNameType), ValueType = schema.ColumnNameType } } ; var superCol = new FluentSuperColumn(superColSchema) { ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, superColSchema.NameType) }; ((ILoadable)superCol).BeginLoad(); foreach (var xcol in col.Columns) { superCol.Columns.Add(ConvertColumnToFluentColumn(xcol, schema)); } ((ILoadable)superCol).EndLoad(); return(superCol); }
public static FluentCounterColumn ConvertColumnToFluentCounterColumn(CounterColumn col, CassandraColumnFamilySchema schema) { var colSchema = new CassandraColumnSchema(); if (schema != null) { var name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, schema.ColumnNameType); colSchema = schema.Columns.Where(x => x.Name == name).FirstOrDefault(); if (colSchema == null) { colSchema = new CassandraColumnSchema(); colSchema.NameType = schema.ColumnNameType; colSchema.Name = name; colSchema.ValueType = schema.DefaultColumnValueType; } } var fcol = new FluentCounterColumn(colSchema) { ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, colSchema.NameType), ColumnValue = col.Value }; return fcol; }
public static FluentCounterColumn ConvertColumnToFluentCounterColumn(CounterColumn col, CassandraColumnFamilySchema schema) { var colSchema = new CassandraColumnSchema(); if (schema != null) { var name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, schema.ColumnNameType); colSchema = schema.Columns.Where(x => x.Name == name).FirstOrDefault(); if (colSchema == null) { colSchema = new CassandraColumnSchema(); colSchema.NameType = schema.ColumnNameType; colSchema.Name = name; colSchema.ValueType = schema.DefaultColumnValueType; } } var fcol = new FluentCounterColumn(colSchema) { ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, colSchema.NameType), ColumnValue = col.Value }; return(fcol); }
public static FluentColumn ConvertColumnToFluentColumn(Column col, CassandraColumnFamilySchema schema = null) { var colSchema = new CassandraColumnSchema(); if (schema != null) { var name = CassandraObject.GetTypeFromDatabaseValue(col.Name, schema.ColumnNameType); colSchema = schema.Columns.Where(x => x.Name == name).FirstOrDefault(); if (colSchema == null) { colSchema = new CassandraColumnSchema(); colSchema.NameType = schema.ColumnNameType; colSchema.Name = name; colSchema.ValueType = schema.DefaultColumnValueType; } } var fcol = new FluentColumn(colSchema) { ColumnName = CassandraObject.GetTypeFromDatabaseValue(col.Name, colSchema.NameType), ColumnValue = CassandraObject.GetTypeFromDatabaseValue(col.Value, colSchema.ValueType), ColumnTimestamp = UnixStart.AddMilliseconds(col.Timestamp), }; if (col.__isset.ttl) fcol.ColumnSecondsUntilDeleted = col.Ttl; return fcol; }
public override IEnumerable <FluentSuperColumnFamily> Execute() { var schema = ColumnFamily.GetSchema(); var parent = new CassandraColumnParent { ColumnFamily = ColumnFamily.FamilyName }; if (SuperColumnName != null) { parent.SuperColumn = SuperColumnName; } SlicePredicate = Helper.SetSchemaForSlicePredicate(SlicePredicate, schema, SuperColumnName == null); var output = Session.GetClient().multiget_slice( Keys, parent, SlicePredicate, Session.ReadConsistency ); foreach (var result in output) { var key = CassandraObject.GetCassandraObjectFromDatabaseByteArray(result.Key, schema.KeyValueType); var superColumns = (IEnumerable <FluentSuperColumn>)null; if (SuperColumnName != null) { var superColSchema = new CassandraColumnSchema { NameType = schema.SuperColumnNameType, Name = SuperColumnName, ValueType = schema.ColumnNameType }; var superCol = new FluentSuperColumn(superColSchema, result.Value.Select(col => Helper.ConvertColumnToFluentColumn(col.Column, schema))); ColumnFamily.Context.Attach(superCol); superColumns = new[] { superCol }; } else { superColumns = result.Value.Select(col => Helper.ConvertSuperColumnToFluentSuperColumn(col.Super_column, schema)); } var familyName = ColumnFamily.FamilyName; var r = new FluentSuperColumnFamily(key, familyName, schema, superColumns); ColumnFamily.Context.Attach(r); yield return(r); } }
public static FluentColumn ConvertColumnToFluentColumn(Column col, CassandraColumnSchema colSchema) { colSchema = colSchema ?? new CassandraColumnSchema(); var fcol = new FluentColumn(colSchema) { ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, colSchema.NameType), ColumnValue = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Value, colSchema.ValueType), ColumnTimestamp = TimestampHelper.FromCassandraTimestamp(col.Timestamp), }; if (col.__isset.ttl) fcol.ColumnSecondsUntilDeleted = col.Ttl; return fcol; }
public static FluentColumn ConvertColumnToFluentColumn(Column col, CassandraColumnSchema colSchema) { colSchema = colSchema ?? new CassandraColumnSchema(); var fcol = new FluentColumn(colSchema) { ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, colSchema.NameType), ColumnValue = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Value, colSchema.ValueType), ColumnTimestamp = TimestampHelper.FromCassandraTimestamp(col.Timestamp), }; if (col.__isset.ttl) { fcol.ColumnSecondsUntilDeleted = col.Ttl; } return(fcol); }
public override FluentSuperColumn Execute() { var schema = ColumnFamily.GetSchema(); var superColSchema = new CassandraColumnSchema { NameType = schema.SuperColumnNameType, Name = SuperColumnName, ValueType = schema.ColumnNameType }; var result = new FluentSuperColumn(superColSchema, GetColumns(ColumnFamily)) { ColumnName = SuperColumnName }; ColumnFamily.Context.Attach(result); result.MutationTracker.Clear(); return(result); }
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; }
public static FluentSuperColumn ConvertSuperColumnToFluentSuperColumn(SuperColumn col, CassandraColumnFamilySchema schema) { var superColSchema = new CassandraColumnSchema { Name = col.Name }; if (schema != null) superColSchema = new CassandraColumnSchema { NameType = schema.SuperColumnNameType, Name = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, schema.SuperColumnNameType), ValueType = schema.ColumnNameType }; var superCol = new FluentSuperColumn(superColSchema) { ColumnName = CassandraObject.GetCassandraObjectFromDatabaseByteArray(col.Name, superColSchema.NameType) }; ((ILoadable)superCol).BeginLoad(); foreach (var xcol in col.Columns) superCol.Columns.Add(ConvertColumnToFluentColumn(xcol, schema)); ((ILoadable)superCol).EndLoad(); return superCol; }