The One-Time 0-1 Option: Maybe
Maybe
is an RxJava type for cases where you may get a result, or you may not, or you may get an error.
For the case where you might get a row or you might not, and you would prefer not to have to look for a special exception to identify the zero-rows case, Maybe
is a fine choice:
@Query("SELECT * FROM trips WHERE id=:id")
Maybe<Trip> maybeTripById(String id);
Prev Table of Contents Next
This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.