blob: 4e6b5a7bfcf1a89e9ff0fe5cb118ec50b4e61730 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package ml.docilealligator.infinityforreddit.multireddit;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import java.util.List;
@Dao
public interface MultiRedditDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insert(MultiReddit multiReddit);
@Insert(onConflict = OnConflictStrategy.REPLACE)
void insertAll(List<MultiReddit> multiReddits);
@Query("SELECT * FROM multi_reddits WHERE username = :username AND display_name LIKE '%' || :searchQuery || '%' ORDER BY name COLLATE NOCASE ASC")
LiveData<List<MultiReddit>> getAllMultiRedditsWithSearchQuery(String username, String searchQuery);
@Query("SELECT * FROM multi_reddits WHERE username = :username ORDER BY name COLLATE NOCASE ASC")
List<MultiReddit> getAllMultiRedditsList(String username);
@Query("SELECT * FROM multi_reddits WHERE username = :username AND is_favorite AND display_name LIKE '%' || :searchQuery || '%' ORDER BY name COLLATE NOCASE ASC")
LiveData<List<MultiReddit>> getAllFavoriteMultiRedditsWithSearchQuery(String username, String searchQuery);
@Query("SELECT * FROM multi_reddits WHERE path = :path AND username = :username COLLATE NOCASE LIMIT 1")
MultiReddit getMultiReddit(String path, String username);
@Query("DELETE FROM multi_reddits WHERE name = :name AND username = :username")
void deleteMultiReddit(String name, String username);
@Query("DELETE FROM multi_reddits WHERE path = :path")
void anonymousDeleteMultiReddit(String path);
@Query("DELETE FROM multi_reddits WHERE username = :username")
void deleteAllUserMultiReddits(String username);
}
|