android10 / android10/Android-CleanArchitecture-Kotlin
How to merge multiples repositories response in the use case
- Linguagem predominante
- Kotlin
- Estrelas
- 4.8k
- Forks
- 929
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
In the examples, I see that you are returning the repository result, without implementing any other operation against them. But it is common, that in an use case you have to query a repository and then operate again it result, maybe inserting the result into other repository. How do you handle this scenario?
```kotlin
interface OneRepository {
fun operation(): Either
}
interface OtherRepository {
fun otherOperation() : Either
}
class UseCase(val repository: OneRepository, val otherRepository: OtherRepository) {
fun run(): Either() {
val result = repository.operation()
// TODO("If the result is success, then call the second repository, and if that result is also success return a success result")
// TODO ("How we can handle the error for both repositories?")
}
}
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.