Last active
June 2, 2020 13:14
-
-
Save lomza/50a94f9a74856f2892260f0ac3425e45 to your computer and use it in GitHub Desktop.
MovieDao.kt
This file contains hidden or 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 | |
interface MovieDao { | |
@Query("SELECT * FROM movie WHERE title = :title LIMIT 1") | |
suspend fun findMovieByTitle(title: String?): Movie? | |
@Insert(onConflict = OnConflictStrategy.IGNORE) | |
suspend fun insert(vararg directors: Movie) | |
@Update(onConflict = OnConflictStrategy.IGNORE) | |
suspend fun update(director: Movie) | |
@Query("DELETE FROM movie") | |
suspend fun deleteAll() | |
@get:Query("SELECT * FROM movie ORDER BY title ASC") | |
val allMovies: LiveData<List<Movie>> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment