Created
August 13, 2019 11:35
-
-
Save LukaKordic/ae2cfd086e0ad3dd47b7ceba7d765f90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Dao | |
interface WeatherDao { | |
@Transaction | |
suspend fun updateWeatherAndReturn(weather: WeatherEntity): WeatherEntity { | |
saveWeatherInfo(weather) | |
return getWeatherInfoForCity(weather.name ?: "") | |
} | |
@Insert(onConflict = OnConflictStrategy.REPLACE) | |
suspend fun saveWeatherInfo(weather: WeatherEntity) | |
@Query("SELECT * FROM $WEATHER_TABLE_NAME WHERE name = :city LIMIT 1") | |
suspend fun getWeatherInfoForCity(city: String): WeatherEntity | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment