public Task <IEnumerable <TKey> > RangeFromFilterKeysOnlyAsync <TFilter>(ITransaction tx, string indexName, TFilter startFilter, RangeFilterType startType, TimeSpan timeout, CancellationToken token) where TFilter : IComparable <TFilter>, IEquatable <TFilter> { // Find the index. var index = GetFilterableIndex <TFilter>(indexName); // Find the keys from the start value (inclusively or exclusively) to the end. return(index.RangeFromFilterAsync(tx, startFilter, startType, token)); }
public Task <IEnumerable <TKey> > RangeFilterKeysOnlyAsync <TFilter>(ITransaction tx, string indexName, TFilter startFilter, RangeFilterType startType, TFilter endFilter, RangeFilterType endType, TimeSpan timeout, CancellationToken token) where TFilter : IComparable <TFilter>, IEquatable <TFilter> { // Find the index. var index = GetFilterableIndex <TFilter>(indexName); // Find the keys that fall within this range (inclusively). return(index.RangeFilterAsync(tx, startFilter, startType, endFilter, endType, token)); }
public async Task <IAsyncEnumerable <KeyValuePair <TKey, TValue> > > RangeFromFilterAsync <TFilter>(ITransaction tx, string indexName, TFilter startFilter, RangeFilterType startType, TimeSpan timeout, CancellationToken token) where TFilter : IComparable <TFilter>, IEquatable <TFilter> { // Find the index. var index = GetFilterableIndex <TFilter>(indexName); // Find the keys from the start value (inclusively or exclusively) to the end. var keys = await index.RangeFromFilterAsync(tx, startFilter, startType, token).ConfigureAwait(false); // Get the rows that match this filter. return(GetAllAsync(tx, keys, timeout, token)); }
public Task <IAsyncEnumerable <KeyValuePair <TKey, TValue> > > RangeFilterAsync <TFilter>(ITransaction tx, string index, TFilter startFilter, RangeFilterType startType, TFilter endFilter, RangeFilterType endType) where TFilter : IComparable <TFilter>, IEquatable <TFilter> { return(RangeFilterAsync(tx, index, startFilter, startType, endFilter, endType, DefaultTimeout, CancellationToken.None)); }
/// <summary> /// Retrieves all keys that fall in the given filter range, or an empty array if there are no matches. /// </summary> public Task <IEnumerable <TKey> > RangeFilterAsync(ITransaction tx, TFilter start, RangeFilterType startType, TFilter end, RangeFilterType endType, CancellationToken token) { if (startType == RangeFilterType.Inclusive && endType == RangeFilterType.Inclusive) { return(RangeFilterHelper(tx, f => start.CompareTo(f) <= 0 && f.CompareTo(end) <= 0, token)); } else if (startType == RangeFilterType.Exclusive && endType == RangeFilterType.Inclusive) { return(RangeFilterHelper(tx, f => start.CompareTo(f) < 0 && f.CompareTo(end) <= 0, token)); } else if (startType == RangeFilterType.Inclusive && endType == RangeFilterType.Exclusive) { return(RangeFilterHelper(tx, f => start.CompareTo(f) <= 0 && f.CompareTo(end) < 0, token)); } else if (startType == RangeFilterType.Exclusive && endType == RangeFilterType.Exclusive) { return(RangeFilterHelper(tx, f => start.CompareTo(f) < 0 && f.CompareTo(end) < 0, token)); } else { throw new NotSupportedException("Impossible state, must be Inclusive / Exclusive matrix"); } }
public Task <IEnumerable <TKey> > RangeToFilterAsync(ITransaction tx, TFilter end, RangeFilterType endType, CancellationToken token) { if (endType == RangeFilterType.Inclusive) { return(RangeFilterHelper(tx, f => f.CompareTo(end) <= 0, token)); } else if (endType == RangeFilterType.Exclusive) { return(RangeFilterHelper(tx, f => f.CompareTo(end) < 0, token)); } else { throw new NotSupportedException("Impossible state, must be either Inclusive or Exclusive"); } }