question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RxJava only works with Queries?

See original GitHub issue

Is it not possible (out of the box) to use RxJava for insert/update? Like return a Flowable<Long> or Flowable<Any> instead.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
proninyaroslavcommented, Dec 10, 2018

@florina-muntenescu What about LiveData support?

0reactions
involve-itcommented, Apr 14, 2019

@involve-it For example:

@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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rxjava: Insert only works with single but not with completable
This line is the source of the issue: return Completable.fromAction(() -> appDatabase.userDao().addData(modelClass)). appDatabase.userDao().
Read more >
Doing queries in Room with RxJava
The queries returning LiveData and Flowable are observable queries. They allow you to get automatic updates whenever the data changes to make sure...
Read more >
The Simplicity of RxJava with N1QL Queries and Couchbase
It works well and isn't particularly difficult, but I find it to be a little messy, and well, synchronous.
Read more >
Top 14 RxJava Interview Questions and Answer Updated ...
Guide to RxJava Interview Questions. Here we also discuss the introduction and top 14 RxJava interview questions along with an explanation.
Read more >
Write asynchronous DAO queries
Kotlin with Flow and couroutines; Java with RxJava ... One-shot read queries that read data from your database only once and return a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found