2018-12-27 06:54:19 +01:00
|
|
|
package SubscribedUserDatabase;
|
2018-07-29 14:25:55 +02:00
|
|
|
|
|
|
|
import android.arch.lifecycle.LiveData;
|
|
|
|
import android.arch.persistence.room.Dao;
|
|
|
|
import android.arch.persistence.room.Insert;
|
|
|
|
import android.arch.persistence.room.OnConflictStrategy;
|
|
|
|
import android.arch.persistence.room.Query;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface SubscribedUserDao {
|
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
|
|
|
void insert(SubscribedUserData subscribedUserData);
|
|
|
|
|
|
|
|
@Query("DELETE FROM subscribed_users")
|
|
|
|
void deleteAllSubscribedUsers();
|
|
|
|
|
2019-01-11 04:33:32 +01:00
|
|
|
@Query("SELECT * FROM subscribed_users ORDER BY name COLLATE NOCASE ASC")
|
2018-07-29 14:25:55 +02:00
|
|
|
LiveData<List<SubscribedUserData>> getAllSubscribedUsers();
|
2019-01-11 04:33:32 +01:00
|
|
|
|
|
|
|
@Query("SELECT * FROM subscribed_users WHERE name = :userName LIMIT 1")
|
|
|
|
SubscribedUserData getSubscribedUser(String userName);
|
|
|
|
|
|
|
|
@Query("DELETE FROM subscribed_users WHERE name = :userName")
|
|
|
|
void deleteSubscribedUser(String userName);
|
2018-07-29 14:25:55 +02:00
|
|
|
}
|