2018-12-27 06:54:19 +01:00
|
|
|
package SubredditDatabase;
|
2018-07-31 18:15:58 +02:00
|
|
|
|
2019-02-21 10:24:23 +01:00
|
|
|
import androidx.lifecycle.LiveData;
|
|
|
|
import androidx.room.Dao;
|
|
|
|
import androidx.room.Insert;
|
|
|
|
import androidx.room.OnConflictStrategy;
|
|
|
|
import androidx.room.Query;
|
2018-07-31 18:15:58 +02:00
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface SubredditDao {
|
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
|
|
void insert(SubredditData SubredditData);
|
|
|
|
|
|
|
|
@Query("DELETE FROM subreddits")
|
|
|
|
void deleteAllSubreddits();
|
|
|
|
|
2019-01-21 09:50:10 +01:00
|
|
|
@Query("SELECT * from subreddits WHERE name = :namePrefixed COLLATE NOCASE LIMIT 1")
|
2019-01-07 12:03:49 +01:00
|
|
|
LiveData<SubredditData> getSubredditLiveDataByName(String namePrefixed);
|
2018-08-10 02:22:56 +02:00
|
|
|
|
2019-01-21 09:50:10 +01:00
|
|
|
@Query("SELECT * from subreddits WHERE name = :namePrefixed COLLATE NOCASE LIMIT 1")
|
2018-08-10 02:22:56 +02:00
|
|
|
SubredditData getSubredditData(String namePrefixed);
|
2018-07-31 18:15:58 +02:00
|
|
|
}
|