forked from agzam/vyatsu-schedule
23 lines
661 B
Kotlin
23 lines
661 B
Kotlin
package agzam.vyatsu.data.local
|
|||
|
|
|
||
|
|
import androidx.room.Dao
|
||
|
|
import androidx.room.Insert
|
||
|
|
import androidx.room.OnConflictStrategy
|
||
|
|
import androidx.room.Query
|
||
|
|
import kotlinx.coroutines.flow.Flow
|
||
|
|
|
||
|
|
@Dao
|
||
|
|
interface ScheduleDao {
|
||
|
|
@Query("SELECT * FROM schedules WHERE groupId = :groupId")
|
||
|
|
fun observe(groupId: String): Flow<ScheduleEntity?>
|
||
|
|
|
||
|
|
@Query("SELECT * FROM schedules WHERE groupId = :groupId")
|
||
|
|
suspend fun get(groupId: String): ScheduleEntity?
|
||
|
|
|
||
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||
|
|
suspend fun upsert(entity: ScheduleEntity)
|
||
|
|
|
||
|
|
@Query("DELETE FROM schedules WHERE groupId = :groupId")
|
||
|
|
suspend fun delete(groupId: String)
|
||
|
|
}
|