Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Created December 9, 2017 07:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkshayChordiya/030ac9e162fc5f0b80c4a55e1d74fcdb to your computer and use it in GitHub Desktop.
Save AkshayChordiya/030ac9e162fc5f0b80c4a55e1d74fcdb to your computer and use it in GitHub Desktop.
User DAO with transaction
@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