-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Datasource: Add type alias StateData (#216)
- Loading branch information
1 parent
c385c63
commit 9112044
Showing
3 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
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
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
7 changes: 7 additions & 0 deletions
7
...sources/datasources-core/src/commonMain/kotlin/com/mirego/trikot/datasources/StateData.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.mirego.trikot.datasources | ||
|
||
typealias StateData<V> = DataState<V, Throwable> | ||
|
||
fun <V> stateDataPending(value: V? = null): StateData<V> = DataState.pending(value) | ||
fun <V> stateDataData(value: V): StateData<V> = DataState.data(value) | ||
fun <V> stateDataError(error: Throwable, value: V? = null): StateData<V> = DataState.error(error, value) |