New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RxJava only works with Queries? #162
Comments
Since you use LiveData to listen for changes, you may use RxJava to listen for changed by observing Select * ... The return value of update/delete are the row/inserted id which isnt used to observe for changes. If you really want to get this value in a different Thread use Flowable.fromCallable() Flowable.create() or Flowable.just(). I think this may be the reason for that. |
There is already a bug raised for this on the official bug tracker, here. |
i am also looking forward for this feature availability |
1+ |
RxJava is supported for insert/update/delete since Room 2.1.0-alpha01 |
@florina-muntenescu What about LiveData support? |
Could you please give us a hint on how to use it with room's insert/update/delete? |
@involve-it @Insert
Single<List<Long>> add(Foo... f); /* Id of added rows */
@Delete
Single<Integer> delete(Foo... f); /* Num of deleted rows */
@Update
Single<Integer> update(Foo... f); /* Num of updated rows */ And how to observe it: Disposable d = db.fooDao().add(new Foo("bar"))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(ids -> /* Do stuff */);
disposables.add(d); |
Awesome, thanks! |
Is it not possible (out of the box) to use RxJava for insert/update?
Like return a
Flowable<Long>
orFlowable<Any>
instead.The text was updated successfully, but these errors were encountered: