You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should the library provide artifacts for easier testing in unit tests? Something like an in-memory store would similar to JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY) could be provided. It could have simple implementation like this:
class KStoreInMemoryCodec<T : @Serializable Any>(
private val json: Json,
private val serializer: KSerializer<T>
) : Codec<T> {
private var storedData: String? = null
override suspend fun decode(): T? =
storedData?.let {
try {
json.decodeFromString(serializer, it)
} catch (e: SerializationException) {
null
}
}
override suspend fun encode(value: T?) {
storedData = value?.let { json.encodeToString(serializer, it) }
}
}
The text was updated successfully, but these errors were encountered:
Should the library provide artifacts for easier testing in unit tests? Something like an in-memory store would similar to
JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
could be provided. It could have simple implementation like this:The text was updated successfully, but these errors were encountered: