public static FdbSubspace Partition(this IFdbSubspace subspace, [NotNull] IFdbTuple tuple) { if (tuple == null) { throw new ArgumentNullException("tuple"); } if (tuple.Count == 0) { return(new FdbSubspace(subspace.ToFoundationDbKey())); } else { return(new FdbSubspace(FdbTuple.PackWithPrefix(subspace.ToFoundationDbKey(), tuple))); } }
/// <summary>Create a new key by appending three values to the current subspace</summary> /// <typeparam name="T1">Type of the first value</typeparam> /// <typeparam name="T2">Type of the second value</typeparam> /// <typeparam name="T3">Type of the third value</typeparam> /// <typeparam name="T4">Type of the fourth value</typeparam> /// <param name="key1">Value that will be appended first</param> /// <param name="key2">Value that will be appended second</param> /// <param name="key3">Value that will be appended third</param> /// <param name="key4">Value that will be appended fourth</param> /// <returns>Key the correspond to the concatenation of the current subspace's prefix, <paramref name="key1"/>, <paramref name="key2"/>, <paramref name="key3"/> and <paramref name="key4"/></returns> /// <example>tuple.Pack(w, x, y, z) is equivalent to tuple.Append(w).Append(x).Append(y).Append(z).ToSlice()</example> public static Slice Pack <T1, T2, T3, T4>(this IFdbSubspace subspace, T1 key1, T2 key2, T3 key3, T4 key4) { return(FdbTuple.PackWithPrefix <T1, T2, T3, T4>(subspace.ToFoundationDbKey(), key1, key2, key3, key4)); }
/// <summary>Create a new key by appending a value to the current subspace</summary> /// <typeparam name="T">Type of the value</typeparam> /// <param name="key">Value that will be appended at the end of the key</param> /// <returns>Key the correspond to the concatenation of the current subspace's prefix and <paramref name="key"/></returns> /// <example>tuple.Pack(x) is equivalent to tuple.Append(x).ToSlice()</example> public static Slice Pack <T>(this IFdbSubspace subspace, T key) { return(FdbTuple.PackWithPrefix <T>(subspace.ToFoundationDbKey(), key)); }
/// <summary>Create a new key by appending a formattable object to the current subspace</summary> /// <param name="tuple">Tuple to pack (can be empty)</param> /// <returns>Key the correspond to the concatenation of the current subspace's prefix and the packed representation of <paramref name="tuple"/></returns> public static Slice Pack(this IFdbSubspace subspace, IFdbTuple tuple) { return(FdbTuple.PackWithPrefix(subspace.ToFoundationDbKey(), tuple)); }
public static FdbSubspace Partition <T1, T2, T3, T4>(this IFdbSubspace subspace, T1 value1, T2 value2, T3 value3, T4 value4) { //TODO: this should go into a FdbTupleSubspace, because it collides with FdbEncoderSubspace<T1, T2, T3, T4> ! return(new FdbSubspace(FdbTuple.PackWithPrefix(subspace.ToFoundationDbKey(), new FdbTuple <T1, T2, T3, T4>(value1, value2, value3, value4)))); }
public static FdbSubspace Partition <T>(this IFdbSubspace subspace, T value) { //TODO: this should go into a FdbTupleSubspace, because it collides with FdbEncoderSubspace<T> ! return(new FdbSubspace(FdbTuple.PackWithPrefix <T>(subspace.ToFoundationDbKey(), value))); }