mirror of https://git.sr.ht/~oppen/ariane
24 lines
751 B
Kotlin
24 lines
751 B
Kotlin
package oppen.ariane.io.database.bookmarks
|
|
|
|
import androidx.room.*
|
|
|
|
@Dao
|
|
interface BookmarksDao {
|
|
@Query("SELECT * FROM bookmarks ORDER BY uiIndex ASC")
|
|
suspend fun getAll(): List<BookmarkEntity>
|
|
|
|
@Query("SELECT * from bookmarks WHERE uiIndex = :index LIMIT 1")
|
|
suspend fun getBookmark(index: Int): BookmarkEntity
|
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
suspend fun insertAll(vararg bookmarks: BookmarkEntity)
|
|
|
|
@Query("UPDATE bookmarks SET uiIndex=:index WHERE uid = :id")
|
|
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)
|
|
|
|
@Delete
|
|
suspend fun delete(bookmark: BookmarkEntity)
|
|
} |