aboutsummaryrefslogblamecommitdiff
path: root/app/src/main/java/User/UserDao.java
blob: 7aba086dc51a6ed4da31dd3b5109e209a3b97d76 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

             
                                       







                                                        
                                   



                               




                                                                
 
package User;

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;

@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 LIMIT 1")
    LiveData<UserData> getUserLiveData(String userName);

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