preparing the migration to Room database

This commit is contained in:
tibbi
2018-11-07 12:18:52 +01:00
parent db6642ca9e
commit e7ff0c6e15
11 changed files with 118 additions and 13 deletions

View File

@ -0,0 +1,19 @@
package com.simplemobiletools.notes.pro.interfaces
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.simplemobiletools.notes.pro.models.Note
@Dao
interface NotesDao {
@Query("SELECT * FROM notes")
fun getNotes(): List<Note>
@Query("SELECT * FROM notes WHERE id = :id")
fun getNoteWithId(id: Int): Note?
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertOrUpdate(note: Note): Long
}