Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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