Skip to content

Instantly share code, notes, and snippets.

@Zhuinden
Last active November 27, 2019 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zhuinden/65ef616a184d7a6e98424d6755d7d119 to your computer and use it in GitHub Desktop.
Save Zhuinden/65ef616a184d7a6e98424d6755d7d119 to your computer and use it in GitHub Desktop.
Anemic Repository 6
// this is an anti-pattern (technically code smell)
class UserRepository(
private val userDao: UserDao
) {
fun getAllUsersWithChanges(): LiveData<List<User>> =
userDao.getAllUserWithChanges()
fun getAllUsers(): List<User> =
userDao.getAllUsers()
fun getUserByIdWithChanges(userId: String): LiveData<User> =
userDao.getUserWithChanges(userId)
fun deleteUserById(userId: String) {
userDao.deleteUserById(userId)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment