Refactor weather widget
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
package de.mm20.launcher2.database
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy.REPLACE
|
||||
import androidx.room.Query
|
||||
import androidx.room.Transaction
|
||||
import de.mm20.launcher2.database.entities.ForecastEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface WeatherDao {
|
||||
@Query("SELECT * FROM ${ForecastEntity.TABLE_NAME} ORDER BY timestamp ASC")
|
||||
fun getForecasts(): LiveData<List<ForecastEntity>>
|
||||
fun getForecasts(): Flow<List<ForecastEntity>>
|
||||
|
||||
@Insert(onConflict = REPLACE)
|
||||
fun insertAll(forecasts: List<ForecastEntity>)
|
||||
|
||||
Reference in New Issue
Block a user