Created
December 9, 2017 07:08
-
-
Save AkshayChordiya/030ac9e162fc5f0b80c4a55e1d74fcdb to your computer and use it in GitHub Desktop.
User DAO with transaction
This file contains 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
@Dao | |
abstract class UserDao { | |
@Insert | |
abstract fun insert(user: User) | |
@Update | |
abstract fun update(user: User) | |
@Transaction | |
fun insertAndUpdate(user: User) { | |
insert(user) | |
update(user.also { it.name.capitalize() }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment