Заготовка
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package chats.data.local.dao
|
||||
|
||||
import androidx.room.*
|
||||
import chats.data.local.database.UserProfileEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
/**
|
||||
* DAO для операций с профилями пользователей в Room Database
|
||||
*/
|
||||
@Dao
|
||||
interface UserProfileDao {
|
||||
|
||||
@Query("SELECT * FROM user_profile WHERE userId = :userId LIMIT 1")
|
||||
suspend fun getUserById(userId: String): UserProfileEntity?
|
||||
|
||||
@Query("SELECT * FROM user_profile WHERE userId = :userId")
|
||||
fun getUserByIdFlow(userId: String): Flow<UserProfileEntity?>
|
||||
|
||||
@Query("SELECT * FROM user_profile")
|
||||
fun getAllUsers(): Flow<List<UserProfileEntity>>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertUser(user: UserProfileEntity)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertUsers(users: List<UserProfileEntity>)
|
||||
|
||||
@Update
|
||||
suspend fun updateUser(user: UserProfileEntity)
|
||||
|
||||
@Delete
|
||||
suspend fun deleteUser(user: UserProfileEntity)
|
||||
|
||||
@Query("DELETE FROM user_profile WHERE userId = :userId")
|
||||
suspend fun deleteUserById(userId: String)
|
||||
}
|
||||
Reference in New Issue
Block a user