Created
May 2, 2020 10:41
-
-
Save pavlospt/42e6c9141aa37679f1519d0ed7d28de8 to your computer and use it in GitHub Desktop.
ResultUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class ResultUseCase<Type, in Params> where Type : Any { | |
protected abstract val workDispatcher: CoroutineDispatcher | |
abstract suspend fun run(params: Params): Result<Type> | |
suspend operator fun invoke(params: Params): Result<Type> = withContext(workDispatcher) { | |
run(params) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment