Interface that use ICityService interface to describe the rules (by defining SQL querys) of our methods
This commit is contained in:
parent
641bb55b72
commit
ce76466a0a
@ -0,0 +1,30 @@
|
||||
package fr.romanet.vj.apps.myweather.dao;
|
||||
|
||||
import androidx.room.Dao;
|
||||
import androidx.room.Delete;
|
||||
import androidx.room.Insert;
|
||||
import androidx.room.OnConflictStrategy;
|
||||
import androidx.room.Query;
|
||||
import fr.romanet.vj.apps.myweather.ICityService;
|
||||
import fr.romanet.vj.apps.myweather.bo.City;
|
||||
import java.util.List;
|
||||
|
||||
@Dao
|
||||
public interface CityDao extends ICityService
|
||||
{
|
||||
@Override
|
||||
@Query("SELECT * FROM City")
|
||||
List<City> getCity();
|
||||
|
||||
@Override
|
||||
@Delete
|
||||
void deleteCity(City cityToDelete);
|
||||
|
||||
@Override
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void addCity(City cityToAdd);
|
||||
|
||||
@Override
|
||||
@Query("SELECT * FROM City ORDER BY nameCity DESC")
|
||||
List<City> sortCityByName();
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user