public PagingIterator(FdbRangeQuery <T> query, IFdbReadOnlyTransaction transaction) { Contract.Requires(query != null); this.Query = query; this.Transaction = transaction ?? query.Transaction; }
public ResultIterator([NotNull] FdbRangeQuery <T> query, IFdbReadOnlyTransaction transaction, [NotNull] Func <KeyValuePair <Slice, Slice>, T> transform) { Contract.Requires(query != null && transform != null); m_query = query; m_transaction = transaction ?? query.Transaction; m_resultTransform = transform; }
public static FdbRangeQuery <TValue> Values <TKey, TValue>([NotNull] this FdbRangeQuery <KeyValuePair <TKey, TValue> > query) { Contract.NotNull(query, nameof(query)); var f = query.Transform; //note: we only keep a reference on 'f' to allow the previous query instance to be collected. Contract.Assert(f != null); return(query.Map <TValue>((x) => f(x).Value)); }
/// <summary>Copy constructor</summary> private FdbRangeQuery([NotNull] FdbRangeQuery <T> query, [NotNull] FdbRangeOptions options) { Contract.Requires(query != null && options != null); this.Transaction = query.Transaction; this.Begin = query.Begin; this.End = query.End; this.Transform = query.Transform; this.Snapshot = query.Snapshot; this.Options = options; this.OriginalRange = query.OriginalRange; }
public static FdbRangeQuery <TResult> Keys <TKey, TValue, TResult>([NotNull] this FdbRangeQuery <KeyValuePair <TKey, TValue> > query, [NotNull] Func <TKey, TResult> transform) { Contract.NotNull(query, nameof(query)); Contract.NotNull(transform, nameof(transform)); var f = query.Transform; //note: we only keep a reference on 'f' to allow the previous query instance to be collected. Contract.Assert(f != null); return(query.Map <TResult>((x) => transform(f(x).Key))); }
public override AsyncIterator <TResult> Select <TResult>(Func <T, TResult> selector) { var query = new FdbRangeQuery <TResult>( m_transaction, m_query.Begin, m_query.End, (x) => selector(m_resultTransform(x)), m_query.Snapshot, m_query.Options ); return(new FdbRangeQuery <TResult> .ResultIterator(query, m_transaction, query.Transform)); }
public static FdbRangeQuery <V> Values <K, V>(this FdbRangeQuery <KeyValuePair <K, V> > query) { if (query == null) { throw new ArgumentNullException("query"); } var f = query.Transform; //note: we only keep a reference on 'f' to allow the previous query instance to be collected. Contract.Assert(f != null); return(query.Map <V>((x) => f(x).Value)); }
public static FdbRangeQuery <R> Keys <K, V, R>(this FdbRangeQuery <KeyValuePair <K, V> > query, [NotNull] Func <K, R> transform) { if (query == null) { throw new ArgumentNullException("query"); } if (transform == null) { throw new ArgumentNullException("transform"); } var f = query.Transform; //note: we only keep a reference on 'f' to allow the previous query instance to be collected. Contract.Assert(f != null); return(query.Map <R>((x) => transform(f(x).Key))); }