2019-01-01 16:32:03 +01:00
|
|
|
package User;
|
|
|
|
|
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;
|
2019-01-01 16:32:03 +01:00
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface UserDao {
|
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
2019-01-11 04:33:32 +01:00
|
|
|
void insert(UserData userData);
|
2019-01-01 16:32:03 +01:00
|
|
|
|
|
|
|
@Query("DELETE FROM users")
|
|
|
|
void deleteAllUsers();
|
|
|
|
|
2019-01-21 09:50:10 +01:00
|
|
|
@Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
|
2019-01-11 04:33:32 +01:00
|
|
|
LiveData<UserData> getUserLiveData(String userName);
|
|
|
|
|
2019-01-21 09:50:10 +01:00
|
|
|
@Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
|
2019-01-11 04:33:32 +01:00
|
|
|
UserData getUserData(String userName);
|
2019-01-01 16:32:03 +01:00
|
|
|
}
|