本文整理汇总了C#中CassandraObject类的典型用法代码示例。如果您正苦于以下问题:C# CassandraObject类的具体用法?C# CassandraObject怎么用?C# CassandraObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CassandraObject类属于命名空间,在下文中一共展示了CassandraObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetBytes
private byte[] GetBytes(CassandraObject[] components)
{
using (var bytes = new MemoryStream())
{
foreach (var c in components)
{
var b = (byte[])c;
var length = (ushort)b.Length;
// comparator part
bytes.WriteByte((byte)1);
bytes.WriteByte((byte)_aliases.FirstOrDefault(x => x.Value == c.GetType()).Key);
// value length
bytes.Write(BitConverter.GetBytes(length), 0, 2);
// value
bytes.Write(b, 0, length);
// end of component
bytes.WriteByte((byte)0);
}
return bytes.ToArray();
}
}
开发者ID:nativex,项目名称:fluentcassandra,代码行数:26,代码来源:DynamicCompositeTypeTest.cs
示例2: InsertCounterColumn
public static void InsertCounterColumn(this CassandraColumnFamily family, CassandraObject key,
CassandraObject superColumnName, CassandraObject columnName,
long columnValue)
{
var op = new AddColumn(key, superColumnName, columnName, columnValue);
family.ExecuteOperation(op);
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:7,代码来源:CassandraColumnFamilyOperations.cs
示例3: CassandraRangeSlicePredicate
public CassandraRangeSlicePredicate(CassandraObject start, CassandraObject finish, bool reversed = false, int count = 100)
{
Start = start;
Finish = finish;
Reversed = reversed;
Count = count;
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:7,代码来源:CassandraRangeSlicePredicate.cs
示例4: get
public Apache.Cassandra.ColumnOrSuperColumn get(CassandraObject key, CassandraColumnPath column_path, Apache.Cassandra.ConsistencyLevel consistency_level)
{
return _client.get(
key.TryToBigEndian(),
Helper.CreateColumnPath(column_path),
consistency_level);
}
开发者ID:nathannis,项目名称:fluentcassandra,代码行数:7,代码来源:CassandraClientWrapper.cs
示例5: add
public void add(CassandraObject key, CassandraColumnParent column_parent, CassandraCounterColumn column, Apache.Cassandra.ConsistencyLevel consistency_level)
{
_client.add(
key.TryToBigEndian(),
Helper.CreateColumnParent(column_parent),
Helper.CreateCounterColumn(column),
consistency_level);
}
开发者ID:bjuris,项目名称:fluentcassandra,代码行数:8,代码来源:CassandraClientWrapper.cs
示例6: get_count
public int get_count(CassandraObject key, CassandraColumnParent column_parent, CassandraSlicePredicate predicate, Apache.Cassandra.ConsistencyLevel consistency_level)
{
return _client.get_count(
key.TryToBigEndian(),
Helper.CreateColumnParent(column_parent),
Helper.CreateSlicePredicate(predicate),
consistency_level);
}
开发者ID:nathannis,项目名称:fluentcassandra,代码行数:8,代码来源:CassandraClientWrapper.cs
示例7: CassandraKeyRange
public CassandraKeyRange(CassandraObject startKey, CassandraObject endKey, string startToken, string endToken, int count)
{
StartKey = startKey;
EndKey = endKey;
StartToken = startToken;
EndToken = endToken;
Count = count;
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:8,代码来源:CassandraKeyRange.cs
示例8: InsertColumn
public static void InsertColumn(this CassandraColumnFamily family, CassandraObject key, FluentColumnPath path)
{
var columnName = path.Column.ColumnName;
var columnValue = path.Column.ColumnValue;
var timestamp = path.Column.ColumnTimestamp;
var timeToLive = path.Column.ColumnSecondsUntilDeleted;
var op = new InsertColumn(key, columnName, columnValue, timestamp, timeToLive);
family.ExecuteOperation(op);
}
开发者ID:rsparkyc,项目名称:fluentcassandra,代码行数:10,代码来源:CassandraColumnFamilyOperations.cs
示例9: CassandraQuerySetup
public CassandraQuerySetup()
{
Reverse = false;
KeyCount = 100;
ColumnCount = 100;
Keys = new CassandraObject[0];
Columns = new CassandraObject[0];
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:10,代码来源:CassandraQuerySetup.cs
示例10: Implicit_ByteArray_Cast
public void Implicit_ByteArray_Cast()
{
// arrange
var expected = new CassandraObject[] { (AsciiType)"string1", (LongType)300 };
byte[] bytes = GetBytes(expected);
// act
CompositeType actual = bytes;
// assert
Assert.IsTrue(expected.SequenceEqual(actual));
}
开发者ID:bjuris,项目名称:fluentcassandra,代码行数:12,代码来源:CompositeTypeTest.cs
示例11: CassandraType_Cast
public void CassandraType_Cast()
{
// arranage
var expected = new CassandraObject[] { (AsciiType)"string1", (LongType)300 };
// act
CompositeType actualType = expected;
CassandraObject actual = actualType;
// assert
Assert.IsTrue(expected.SequenceEqual((CassandraObject[])actual));
}
开发者ID:bjuris,项目名称:fluentcassandra,代码行数:12,代码来源:CompositeTypeTest.cs
示例12: JavaBytes_To_CompositeType
public void JavaBytes_To_CompositeType()
{
// arrange
var expected = new CassandraObject[] { (BytesType)_compositeType[0].GetValue<string>(), (BytesType)_compositeType[1].GetValue<long>() };
// act
var actual = new CompositeType();
actual.SetValueFromBigEndian(_javaByteOrder);
// assert
Assert.True(expected.SequenceEqual((CassandraObject[])actual));
}
开发者ID:bjuris,项目名称:fluentcassandra,代码行数:12,代码来源:CompositeTypeTest.cs
示例13: GetBytes
private byte[] GetBytes(CassandraObject[] components)
{
using (var bytes = new MemoryStream())
{
foreach (var c in components)
{
var b = (byte[])c;
var length = (ushort)b.Length;
// value length
bytes.Write(BitConverter.GetBytes(length), 0, 2);
// value
bytes.Write(b, 0, length);
// end of component
bytes.WriteByte((byte)0);
}
return bytes.ToArray();
}
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:22,代码来源:CompositeTypeTest.cs
示例14: SuperColumnCount
public static int SuperColumnCount(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject columnStart, CassandraObject columnEnd, bool reversed = false, int count = 100)
{
var op = new ColumnCount(key, superColumnName, new CassandraRangeSlicePredicate(columnStart, columnEnd, reversed, count));
return family.ExecuteOperation(op);
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:5,代码来源:CassandraSuperColumnFamilyOperations.cs
示例15: GetSingle
public static FluentSuperColumnFamily GetSingle(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject columnStart, CassandraObject columnEnd, bool reversed = false, int count = 100)
{
var op = new GetSuperColumnFamilySlice(key, new CassandraRangeSlicePredicate(columnStart, columnEnd, reversed, count));
return family.ExecuteOperation(op);
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:5,代码来源:CassandraSuperColumnFamilyOperations.cs
示例16: GetColumn
public static FluentColumn GetColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject columnName)
{
var op = new GetColumn(key, superColumnName, columnName);
return family.ExecuteOperation(op);
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:5,代码来源:CassandraSuperColumnFamilyOperations.cs
示例17: InsertColumn
public static void InsertColumn(this CassandraSuperColumnFamily family, CassandraObject key, CassandraObject superColumnName, CassandraObject name, BytesType value, DateTimeOffset timestamp, int? timeToLive)
{
var op = new InsertColumn(key, superColumnName, name, value, timestamp, timeToLive);
family.ExecuteOperation(op);
}
开发者ID:achinn,项目名称:fluentcassandra,代码行数:5,代码来源:CassandraSuperColumnFamilyOperations.cs
示例18: remove_counter
public void remove_counter(CassandraObject key, CassandraColumnPath path, Apache.Cassandra.ConsistencyLevel consistency_level)
{
_client.remove_counter(
key.TryToBigEndian(),
Helper.CreateColumnPath(path),
consistency_level);
}
开发者ID:bjuris,项目名称:fluentcassandra,代码行数:7,代码来源:CassandraClientWrapper.cs
示例19: remove
public void remove(CassandraObject key, CassandraColumnPath column_path, long timestamp, Apache.Cassandra.ConsistencyLevel consistency_level)
{
_client.remove(
key.TryToBigEndian(),
Helper.CreateColumnPath(column_path),
timestamp,
consistency_level);
}
开发者ID:bjuris,项目名称:fluentcassandra,代码行数:8,代码来源:CassandraClientWrapper.cs
示例20: GetCassandraType
public static CassandraType GetCassandraType(CassandraObject obj)
{
var typeName = obj.GetType().Name;
var cassandraType = (CassandraType)null;
switch (typeName.ToLower())
{
case "asciitype": cassandraType = AsciiType; break;
case "booleantype": cassandraType = BooleanType; break;
case "bytestype": cassandraType = BytesType; break;
case "datetype": cassandraType = DateType; break;
case "decimaltype": cassandraType = DecimalType; break;
case "doubletype": cassandraType = DoubleType; break;
case "floattype": cassandraType = FloatType; break;
case "int32type": cassandraType = Int32Type; break;
case "integertype": cassandraType = IntegerType; break;
case "lexicaluuidtype": cassandraType = LexicalUUIDType; break;
case "longtype": cassandraType = LongType; break;
case "timeuuidtype": cassandraType = TimeUUIDType; break;
case "utf8type": cassandraType = UTF8Type; break;
case "uuidtype": cassandraType = UUIDType; break;
case "emptytype": cassandraType = EmptyType; break;
case "inetaddresstype": cassandraType = InetAddressType; break;
// these need work
//case "compositetype": cassandraType = CompositeType; break;
//case "dynamiccompositetype": cassandraType = DynamicCompositeType; break;
//case "countercolumntype": cassandraType = CounterColumnType; break;
//case "reversedtype": cassandraType = ReversedType; break;
default: throw new CassandraException("Type '" + typeName + "' not found.");
}
return cassandraType;
}
开发者ID:nathannis,项目名称:fluentcassandra,代码行数:33,代码来源:CassandraType.cs
注:本文中的CassandraObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论