android10 / android10/Android-CleanArchitecture-Kotlin

How to merge multiples repositories response in the use case

未关闭
#99 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Kotlin
星标
4.8k
派生
929
PR 合并指标
30 天内没有已合并 PR

描述

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?")
}

}
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。