Skip to content

Instantly share code, notes, and snippets.

@deepanshu42
Created May 23, 2020 07:05
Show Gist options
  • Save deepanshu42/1fed7a4f6ec1d7c4ee21b68175252030 to your computer and use it in GitHub Desktop.
Save deepanshu42/1fed7a4f6ec1d7c4ee21b68175252030 to your computer and use it in GitHub Desktop.
Parameter passing in Room Dao Example
@Dao
interface UserDao {
@Query("SELECT * FROM users WHERE age BETWEEN :minAge AND :maxAge")
fun loadAllUsersBetweenAges(minAge: Int, maxAge: Int): Array<User>
@Query("SELECT * FROM users WHERE first_name LIKE :search " +
"OR last_name LIKE :search")
fun findUserWithName(search: String): List<User>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment