本文整理汇总了C#中CassandraObject类的典型用法代码示例。如果您正苦于以下问题:C# CassandraObject类的具体用法?C# CassandraObject怎么用?C# CassandraObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CassandraObject类属于命名空间,在下文中一共展示了CassandraObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
示例3: CassandraRangeSlicePredicate
public CassandraRangeSlicePredicate(CassandraObject start, CassandraObject finish, bool reversed = false, int count = 100)
{
Start = start;
Finish = finish;
Reversed = reversed;
Count = count;
}
示例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);
}
示例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);
}
示例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);
}
示例7: CassandraKeyRange
public CassandraKeyRange(CassandraObject startKey, CassandraObject endKey, string startToken, string endToken, int count)
{
StartKey = startKey;
EndKey = endKey;
StartToken = startToken;
EndToken = endToken;
Count = count;
}
示例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);
}
示例9: CassandraQuerySetup
public CassandraQuerySetup()
{
Reverse = false;
KeyCount = 100;
ColumnCount = 100;
Keys = new CassandraObject[0];
Columns = new CassandraObject[0];
}
示例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));
}
示例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));
}
示例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));
}
示例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();
}
}
示例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);
}
示例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);
}