Ejemplo n.º 1
0
 /// <summary>Return the keys that are in the first range, but not in the others</summary>
 /// <typeparam name="TKey">Type of the keys used for the comparison</typeparam>
 /// <typeparam name="TResult">Type of the results returned by the query</typeparam>
 /// <param name="trans">Transaction used by the operation</param>
 /// <param name="ranges">List of at least one key ranges</param>
 /// <param name="keySelector">Lambda called to extract the keys used by the sort</param>
 /// <param name="resultSelector">Lambda called to extract the values returned by the query</param>
 /// <param name="keyComparer">Instance used to compare the keys returned by <paramref name="keySelector"/></param>
 /// <returns>Async query that returns only the results that are in the first range, and not in any other range.</returns>
 public static IFdbAsyncEnumerable <TResult> Except <TKey, TResult>(this IFdbReadOnlyTransaction trans, IEnumerable <FdbKeyRange> ranges, Func <KeyValuePair <Slice, Slice>, TKey> keySelector, Func <KeyValuePair <Slice, Slice>, TResult> resultSelector, IComparer <TKey> keyComparer = null)
 {
     if (ranges == null)
     {
         throw new ArgumentNullException("ranges");
     }
     return(Except <TKey, TResult>(trans, ranges.Select(r => FdbKeySelectorPair.Create(r)), keySelector, resultSelector, keyComparer));
 }
        /// <summary>Construct a query with a set of initial settings</summary>
        internal FdbRangeQuery([NotNull] IFdbReadOnlyTransaction transaction, FdbKeySelector begin, FdbKeySelector end, [NotNull] Func <KeyValuePair <Slice, Slice>, T> transform, bool snapshot, FdbRangeOptions options)
        {
            Contract.Requires(transaction != null && transform != null);

            this.Transaction   = transaction;
            this.Begin         = begin;
            this.End           = end;
            this.Transform     = transform;
            this.Snapshot      = snapshot;
            this.Options       = options ?? new FdbRangeOptions();
            this.OriginalRange = FdbKeySelectorPair.Create(begin, end);
        }
 public static FdbKeySelectorPair ToSelectorPair(this FdbSubspace subspace)
 {
     return(FdbKeySelectorPair.Create(subspace.ToRange()));
 }