Last active
November 30, 2024 16:10
-
-
Save anitaa1990/eaeb6b393a8d4ca08cb42e07f3622833 to your computer and use it in GitHub Desktop.
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's are data access objects. They includes methods that offer abstract access | |
| * to the app's database. At compile time, Room automatically generates implementations | |
| * of the DAOs that we define. | |
| */ | |
| @Dao | |
| interface NoteDao { | |
| @Insert(onConflict = OnConflictStrategy.REPLACE) | |
| suspend fun insertNote(note: Note): Long | |
| @Update | |
| suspend fun updateNote(note: Note) | |
| @Delete | |
| suspend fun deleteNote(note: Note) | |
| @Query("SELECT * FROM Note") | |
| fun fetchAllNotes(): Flow<List<Note>> | |
| @Query("SELECT * FROM Note WHERE id =:noteId") | |
| fun getNote(noteId: Long): Flow<Note> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment