-
Notifications
You must be signed in to change notification settings - Fork 182
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
Option to get one object instead of list #329
Comments
Yes, I agree that 'null' for blocking variant will be obvious. For rx, we can simply replace 'loadUserFromNetwork' with swithing ui state to empty in main thread, don,t we? |
I am moving this to 1.1.0 |
Would be nice to have this. I really need it. |
@artem-zinnatullin Hey! I have done this feature for the executeAsBlocking case, but not for createObservable yet, because of a lack of experience with RxJava on that level. So should I make a PR? And if yes what base branch should I choose? |
Hi, Ilya! Feel free to open a PR! First contribution is always exciting, we would be Sorry for the delay, we are quite busy this week. On Tue, Nov 17, 2015, 20:43 Ilya notifications@github.com wrote:
@artem_zin |
Hi, Artem!
The problem is that in the case when there are no objects satisfying query - observable never completes and it is impossible to use defaultIfEmpty for example. |
@geralt-encore cool! So, you should not Looks like you understand Russian 😄, so you can try to watch my talk about Rx and it'll hopefully help you understand Rx better https://events.yandex.ru/lib/talks/3106/ I'd rewrite this to something like: observeChangesInTables(tables)
.map(MapSomethingToExecuteAsBlocking.newInstance(this)) // On each change get new result
.startWith(Observable.create(OnSubscribeExecuteAsBlocking.newInstance(this))) // Start with initial result
.subscribeOn(Schedulers.io()); Should work fine! |
@artem-zinnatullin I am not sure that I explained my question well. I was talking about the implementation of |
|
Oh, now I understand the problem with |
But we already do this for |
@artem-zinnatullin Looks like this issue can be closed =) |
@geralt-encore yay! Thanks a lot! |
It was pleasure to merge your PRs! Hope @nikitin-da thinks so too 😄 |
Thanks! I've learned a lot from you guys and looking forward to continuing to contribute into StorIO |
Definitely! Thank you, Ilya! |
Common task — get exactly one object from the db.
I think, it should return
null
ifcursor.getCount() == 0
forexecuteAsBlocking()
, for RxJava it should just complete normally without emitting null, so it'll be possible to applydefaultOrEmpty
Operator.@nikitin-da what do you think?
The text was updated successfully, but these errors were encountered: