2020-04-17 21:08:21 +02:00
|
|
|
package exh.util
|
2020-04-17 19:23:44 +02:00
|
|
|
|
2021-01-21 03:00:23 +01:00
|
|
|
import com.pushtorefresh.storio.operations.PreparedOperation
|
2020-04-17 19:23:44 +02:00
|
|
|
import com.pushtorefresh.storio.sqlite.operations.get.PreparedGetListOfObjects
|
|
|
|
|
import com.pushtorefresh.storio.sqlite.operations.get.PreparedGetObject
|
|
|
|
|
import com.pushtorefresh.storio.sqlite.operations.put.PreparedPutCollectionOfObjects
|
|
|
|
|
import com.pushtorefresh.storio.sqlite.operations.put.PreparedPutObject
|
2020-11-08 21:11:42 +01:00
|
|
|
import com.pushtorefresh.storio.sqlite.operations.put.PutResult
|
|
|
|
|
import com.pushtorefresh.storio.sqlite.operations.put.PutResults
|
2020-04-17 19:23:44 +02:00
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
|
|
import kotlinx.coroutines.withContext
|
|
|
|
|
|
2020-11-11 23:30:38 +01:00
|
|
|
suspend fun <T> PreparedGetListOfObjects<T>.executeOnIO(): List<T> = withContext(Dispatchers.IO) { executeAsBlocking() }
|
2020-04-17 19:23:44 +02:00
|
|
|
|
2020-11-11 23:30:38 +01:00
|
|
|
suspend fun <T> PreparedGetObject<T>.executeOnIO(): T? = withContext(Dispatchers.IO) { executeAsBlocking() }
|
2020-04-17 19:23:44 +02:00
|
|
|
|
2020-11-11 23:30:38 +01:00
|
|
|
suspend fun <T> PreparedPutObject<T>.executeOnIO(): PutResult = withContext(Dispatchers.IO) { executeAsBlocking() }
|
2020-04-17 19:23:44 +02:00
|
|
|
|
2020-11-11 23:30:38 +01:00
|
|
|
suspend fun <T> PreparedPutCollectionOfObjects<T>.executeOnIO(): PutResults<T> = withContext(Dispatchers.IO) { executeAsBlocking() }
|
2021-01-21 03:00:23 +01:00
|
|
|
|
|
|
|
|
suspend fun <T> PreparedOperation<T>.executeOnIO(): T? = withContext(Dispatchers.IO) { executeAsBlocking() }
|