Created
May 23, 2020 09:52
-
-
Save deepanshu42/e67c97644c42f3112d727acfd9d7c1c2 to your computer and use it in GitHub Desktop.
Room generated code for RxJava
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Completable insertLargeNumberOfUsers(final User... users) { | |
return Completable.fromCallable(new Callable<Void>() { | |
@Override | |
public Void call() throws Exception { | |
__db.beginTransaction(); | |
try { | |
__insertionAdapterOfUser.insert(users); | |
__db.setTransactionSuccessful(); | |
return null; | |
} finally { | |
__db.endTransaction(); | |
} | |
} | |
}); | |
} | |
@Override | |
public Single<Integer> deleteAllUsers(final List<User> users) { | |
return Single.fromCallable(new Callable<Integer>() { | |
@Override | |
public Integer call() throws Exception { | |
int _total = 0; | |
__db.beginTransaction(); | |
try { | |
_total +=__deletionAdapterOfUser.handleMultiple(users); | |
__db.setTransactionSuccessful(); | |
return _total; | |
} finally { | |
__db.endTransaction(); | |
} | |
} | |
}); | |
} | |
@Override | |
public Flowable<User> loadUserById(final int id) { | |
final String _sql = "SELECT * from users where uid = ? LIMIT 1"; | |
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1); | |
int _argIndex = 1; | |
_statement.bindLong(_argIndex, id); | |
return RxRoom.createFlowable(__db, false, new String[]{"users"}, new Callable<User>() { | |
@Override | |
public User call() throws Exception { | |
//Implementation | |
} | |
@Override | |
protected void finalize() { | |
_statement.release(); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment