feat: Initial Database stuff for FolderPairs
This commit adds the initial Database design to save and load `FolderPair`s locally
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.fabisahne.cloudsync.data
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.Query
|
||||
import androidx.room.Update
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface FolderPairDao {
|
||||
@Query("SELECT * FROM folder_pairs ORDER BY createdAt DESC")
|
||||
fun getAll(): Flow<List<FolderPair>>
|
||||
|
||||
@Query("SELECT * FROM folder_pairs WHERE id = :id")
|
||||
suspend fun getById(id: Long): FolderPair?
|
||||
|
||||
@Insert
|
||||
suspend fun insert(folderPair: FolderPair): Long
|
||||
|
||||
@Update
|
||||
suspend fun update(folderPair: FolderPair)
|
||||
|
||||
@Delete
|
||||
suspend fun delete(folderPair: FolderPair)
|
||||
}
|
||||
Reference in New Issue
Block a user