greenrobot / ObjectBoxRxJava

Optional RxJava 2 APIs for ObjectBox
Apache License 2.0
71 stars 8 forks source link

Can't use find on a query #3

Open kakai248 opened 6 years ago

kakai248 commented 6 years ago

With the current Rx implementation, it's not possible to use find for pagination.

Take RxQuery.single for example. Since we pass Query<T> and receive a Single<List<T>>, we can't apply that operator.

I really don't have a suggestion on how to fix this decently. Right now, I'm doing:

Single.just(box.query()
                .build()
                .find(from, to)
)

Truth is that I would prefer a somewhat different Rx implementation. Something along the ways of requery (https://github.com/requery/requery).

Thank you.

greenrobot-team commented 6 years ago

We are currently tracking a change to set offset and limit while building the query, instead of when calling find. See https://github.com/objectbox/objectbox-java/issues/303 -ut