Skip to content

Instantly share code, notes, and snippets.

@Farhandroid
Created February 16, 2022 02:20
Show Gist options
  • Save Farhandroid/be02139debe79c063d6079e71108edbd to your computer and use it in GitHub Desktop.
Save Farhandroid/be02139debe79c063d6079e71108edbd to your computer and use it in GitHub Desktop.
MovieDao
@Dao
interface MovieDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun addMovies(movies: List<Movie>)
@Query("SELECT * FROM movies")
fun getAllMovies(): PagingSource<Int, Movie>
@Query("SELECT * FROM movies WHERE movieId = :movieId")
fun getMovie(movieId: Int): Flow<Movie>
@Query("DELETE FROM movies")
suspend fun deleteAllMovies()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment