本文整理汇总了C#中Aerospike.Client.Value.Pack方法的典型用法代码示例。如果您正苦于以下问题:C# Value.Pack方法的具体用法?C# Value.Pack怎么用?C# Value.Pack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aerospike.Client.Value
的用法示例。
在下文中一共展示了Value.Pack方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Append
/// <summary>
/// Create list append operation.
/// Server appends value to end of list bin.
/// Server returns list size.
/// </summary>
public static Operation Append(string binName, Value value)
{
Packer packer = new Packer();
packer.PackRawShort(APPEND);
packer.PackArrayBegin(1);
value.Pack(packer);
byte[] bytes = packer.ToByteArray();
return new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(bytes));
}
示例2: CreateOperation
protected internal static Operation CreateOperation(int command, int attributes, string binName, Value value1, Value value2)
{
Packer packer = new Packer();
packer.PackRawShort(command);
packer.PackArrayBegin(3);
value1.Pack(packer);
value2.Pack(packer);
packer.PackNumber(attributes);
return new Operation(Operation.Type.MAP_MODIFY, binName, Value.Get(packer.ToByteArray()));
}
示例3: CreateRangeOperation
protected internal static Operation CreateRangeOperation(int command, Operation.Type type, string binName, Value begin, Value end, MapReturnType returnType)
{
Packer packer = new Packer();
packer.PackRawShort(command);
if (begin == null)
{
begin = Value.AsNull;
}
if (end == null)
{
packer.PackArrayBegin(2);
packer.PackNumber((int)returnType);
begin.Pack(packer);
}
else
{
packer.PackArrayBegin(3);
packer.PackNumber((int)returnType);
begin.Pack(packer);
end.Pack(packer);
}
return new Operation(type, binName, Value.Get(packer.ToByteArray()));
}
示例4: CreatePut
protected internal static Operation CreatePut(int command, int attributes, string binName, Value value1, Value value2)
{
Packer packer = new Packer();
packer.PackRawShort(command);
if (command == MapBase.REPLACE)
{
// Replace doesn't allow map attributes because it does not create on non-existing key.
packer.PackArrayBegin(2);
value1.Pack(packer);
value2.Pack(packer);
}
else
{
packer.PackArrayBegin(3);
value1.Pack(packer);
value2.Pack(packer);
packer.PackNumber(attributes);
}
return new Operation(Operation.Type.MAP_MODIFY, binName, Value.Get(packer.ToByteArray()));
}
示例5: Set
/// <summary>
/// Create list set operation.
/// Server sets item value at specified index in list bin.
/// Server does not return a result by default.
/// </summary>
public static Operation Set(string binName, int index, Value value)
{
Packer packer = new Packer();
packer.PackRawShort(SET);
packer.PackArrayBegin(2);
packer.PackNumber(index);
value.Pack(packer);
byte[] bytes = packer.ToByteArray();
return new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(bytes));
}