aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/User/UserDao.java
blob: 2bf7b824b5e04d9dcb88b3479028f1ddd4a99fb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package User;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;

@Dao
public interface UserDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(UserData userData);

    @Query("DELETE FROM users")
    void deleteAllUsers();

    @Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
    LiveData<UserData> getUserLiveData(String userName);

    @Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
    UserData getUserData(String userName);
}