Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Created October 22, 2017 10:19
Show Gist options
  • Save AkshayChordiya/a483b26b8c0cb6dd657d416f7ab45459 to your computer and use it in GitHub Desktop.
Save AkshayChordiya/a483b26b8c0cb6dd657d416f7ab45459 to your computer and use it in GitHub Desktop.
User DAO - Room
@Dao
interface UserDao {
@Insert
fun insertAll(users: List<User>)
@Update
fun update(user: User)
@Delete
fun delete(user: User)
@Query("SELECT * FROM users")
fun getUsers(): List<User>
@Query("SELECT * FROM users WHERE name LIKE :name LIMIT 1")
fun getUserByName(name: String): User
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment