Example #1
0
        /// <summary>Return a range of keys</summary>
        /// <param name="query">Source database query</param>
        /// <param name="range">Pair of key selectors</param>
        /// <returns>Query that will return the keys from the specified <paramref name="range"/></returns>
        public static IFdbAsyncSequenceQueryable <KeyValuePair <Slice, Slice> > Range(this IFdbDatabaseQueryable query, KeySelectorPair range)
        {
            if (query == null)
            {
                throw new ArgumentNullException(nameof(query));
            }

            var expr = FdbQueryExpressions.Range(range);

            return(query.Provider.CreateSequenceQuery(expr));
        }
        public void Test_FdbQueryRangeExpression()
        {
            var expr = FdbQueryExpressions.Range(
                KeySelectorPair.Create(TuPack.ToKeyRange("Foo"))
                );

            Log(expr);

            Assert.That(expr, Is.Not.Null);
            Assert.That(expr.Range.Begin.Key.ToString(), Is.EqualTo("<02>Foo<00><00>"));
            Assert.That(expr.Range.End.Key.ToString(), Is.EqualTo("<02>Foo<00><FF>"));

            Assert.That(expr.Type, Is.EqualTo(typeof(IAsyncEnumerable <KeyValuePair <Slice, Slice> >)));
            Assert.That(expr.ElementType, Is.EqualTo(typeof(KeyValuePair <Slice, Slice>)));

            Log(FdbQueryExpressions.ExplainSequence(expr));
        }
Example #3
0
        public void Test_FdbQueryRangeExpression()
        {
            var expr = FdbQueryExpressions.Range(
                FdbTuple.Create("Foo").ToSelectorPair()
                );

            Console.WriteLine(expr);

            Assert.That(expr, Is.Not.Null);
            Assert.That(expr.Range.Begin.Key.ToString(), Is.EqualTo("<02>Foo<00>"));
            Assert.That(expr.Range.End.Key.ToString(), Is.EqualTo("<02>Foo<01>"));

            Assert.That(expr.Type, Is.EqualTo(typeof(IFdbAsyncEnumerable <KeyValuePair <Slice, Slice> >)));
            Assert.That(expr.ElementType, Is.EqualTo(typeof(KeyValuePair <Slice, Slice>)));

            Console.WriteLine(FdbQueryExpressions.ExplainSequence(expr));
        }