Exemple #1
0
        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));
        }
Exemple #2
0
        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 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)));
        }