SHARE
TWEET

Untitled

a guest Aug 25th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Dao
  2. interface WeatherDao {
  3.  
  4.   @Transaction
  5.   suspend fun updateWeatherAndReturn(weather: WeatherEntity): WeatherEntity {
  6.     saveWeatherInfo(weather)
  7.     return getWeatherInfoForCity(weather.name ?: "")
  8.   }
  9.  
  10.   @Insert(onConflict = OnConflictStrategy.REPLACE)
  11.   suspend fun saveWeatherInfo(weather: WeatherEntity)
  12.  
  13.   @Query("SELECT * FROM $WEATHER_TABLE_NAME WHERE name = :city LIMIT 1")
  14.   suspend fun getWeatherInfoForCity(city: String): WeatherEntity
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top