2020-11-16 14:02:56 +00:00
|
|
|
package oppen.ariane.io.database.bookmarks
|
2020-09-07 21:15:18 +00:00
|
|
|
|
|
|
|
import androidx.room.*
|
|
|
|
|
|
|
|
@Dao
|
|
|
|
interface BookmarksDao {
|
2020-09-11 21:02:54 +00:00
|
|
|
@Query("SELECT * FROM bookmarks ORDER BY uiIndex ASC")
|
2020-09-07 21:15:18 +00:00
|
|
|
suspend fun getAll(): List<BookmarkEntity>
|
|
|
|
|
2020-09-11 21:02:54 +00:00
|
|
|
@Query("SELECT * from bookmarks WHERE uiIndex = :index LIMIT 1")
|
|
|
|
suspend fun getBookmark(index: Int): BookmarkEntity
|
|
|
|
|
2020-09-07 21:15:18 +00:00
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
|
|
suspend fun insertAll(vararg bookmarks: BookmarkEntity)
|
|
|
|
|
2020-09-11 21:02:54 +00:00
|
|
|
@Query("UPDATE bookmarks SET uiIndex=:index WHERE uid = :id")
|
2020-10-09 13:53:58 +00:00
|
|
|
fun updateUIIndex(id: Int, index: Int)
|
|
|
|
|
|
|
|
@Query("UPDATE bookmarks SET label=:label, uri=:uri WHERE uid = :id")
|
|
|
|
fun updateContent(id: Int, label: String, uri: String)
|
2020-09-11 21:02:54 +00:00
|
|
|
|
2020-09-07 21:15:18 +00:00
|
|
|
@Delete
|
|
|
|
suspend fun delete(bookmark: BookmarkEntity)
|
|
|
|
}
|