commonMain.tech.skot.model.SKBM.kt Maven / Gradle / Ivy
package tech.skot.model
import kotlinx.serialization.KSerializer
abstract class SKBM(val key: String?) {
open inner class DistantData(
name: String,
serializer: KSerializer,
cache: SKPersistor = globalPersistor,
validity: Long? = null,
fetchData: suspend () -> D
) : SKDistantDataWithCache(
name = name,
serializer = serializer,
key = key,
cache = cache,
validity = validity,
fetchData = fetchData
)
open inner class NullableDistantData(
name: String,
serializer: KSerializer,
cache: SKPersistor = globalPersistor,
validity: Long? = null,
fetchData: suspend () -> D?
) : SKNullableDistantDataWithCache(
name = name,
dataSerializer = serializer,
key = key,
cache = cache,
validity = validity,
fetchData = fetchData
)
open inner class DistantDataWithLiveKey(
name: String,
serializer: KSerializer,
cache: SKPersistor = globalPersistor,
validity: Long? = null,
private val liveKey: () -> String,
fetchData: suspend () -> D
) : SKDistantDataWithCacheAndLiveKey(
name = name,
serializer = serializer,
cache = cache,
validity = validity,
fixKey = key,
liveKey = liveKey,
fetchData = fetchData
)
open inner class PaginatedData(
name: String,
serializer: KSerializer,
cache: SKPersistor = globalPersistor,
validity: Long? = null,
nbItemsInPage: Int,
fetchPage: suspend (index: Int, nbItemsInPage: Int) -> List
) : SKPaginatedDataWithCache(
name = name,
serializer = serializer,
key = key,
cache = cache,
validity = validity,
nbItemsInPage = nbItemsInPage,
fetchPage = fetchPage
)
open inner class ManualData(
name: String,
serializer: KSerializer,
cache: SKPersistor = globalPersistor,
initialDefaultValue: D
) : SKManualDataWithCache(
name = name,
serializer = serializer,
key = key,
cache = cache,
initialDefaultValue = initialDefaultValue
)
open inner class NullableManualData(
name: String,
serializer: KSerializer,
cache: SKPersistor = globalPersistor,
initialDefaultValue: D?
) : SKNullableManualDataWithCache(
name = name,
dataSerializer = serializer,
key = key,
cache = cache,
initialDefaultValue = initialDefaultValue
)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy