Kittyfisto/IsabelDb

Allow range queries

Closed this issue · 1 comments

It should be possible to perform searches such as getting all objects where the key is in the range of [a, b].
This is very easy for types natively supported by the database (such as integers, strings).

This ** might** be possible for serialized types, but only if their serialized bit pattern happens to follow the same rules as the required comparison. If the bit pattern doesn't, then such a query will not work.

The question here is how do we add support for natively supported types without causing users too much headache?

One possibility might be to offer extension methods for IDictionaryObjectStore for only certain key types:

public static IEnumerable<KeyValuePair<int, T>> GetInRange<T>(this IDictionaryObjectStore<int, T> that, int minimum, int maximum)
{...}

This way a user will not have access to GetInRange methods for key types which are not supported just yet (as in she will receive a compile error that there's no such method, instead of receiving a runtime error).

This is now fully implemented through IOrderedCollection and IIntervalCollection, i.e. not as described in this ticket initially.