Files
munich-departures/app/src/main/java/com/example/data/db/SavedStopDao.kt
T

26 lines
650 B
Kotlin

package com.example.data.db
import androidx.room.*
import kotlinx.coroutines.flow.Flow
@Dao
interface SavedStopDao {
@Query("SELECT * FROM saved_stops ORDER BY isCustomOrder ASC, id ASC")
fun getAllSavedStops(): Flow<List<SavedStop>>
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertSavedStop(stop: SavedStop): Long
@Update
suspend fun updateSavedStop(stop: SavedStop)
@Delete
suspend fun deleteSavedStop(stop: SavedStop)
@Query("DELETE FROM saved_stops WHERE id = :id")
suspend fun deleteById(id: Long)
@Query("SELECT COUNT(*) FROM saved_stops")
suspend fun getCount(): Int
}