@Query("UPDATE account set current = 0 where current = 1")
suspend fun removeCurrent()
@Query("UPDATE account set current = 1 where id = :accountId")
suspend fun setCurrent(accountId: Int)
@Query("SELECT * FROM account where current = 1 limit 1")
fun getCurrent(): LiveData<Account?>
I have some function observing the current account (getCurrent).
The problem is when I swap between account I do,
removeCurrent(), setCurrent(acc)
.
But between the calls of those two queries my livedata updates and subsequentially updates the consumers.
I would like to avoid that
(What I get from getCurrent: oldAcc, null, newAcc; What I want oldAcc, newAcc)