mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-21 08:07:16 +00:00
update exposed and adapt to new version of kotlin serialization
This commit is contained in:
parent
d45aef9fe5
commit
f4ee6c2890
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,4 +12,5 @@ out/
|
|||||||
secret.gradle
|
secret.gradle
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
|
||||||
publishing.sh
|
publishing.sh
|
||||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,15 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.9.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.5.31` -> `1.6.10`
|
||||||
|
* `Coroutines`: `1.5.2` -> `1.6.0`
|
||||||
|
* `Serialization`: `1.3.1` -> `1.3.2`
|
||||||
|
* `Exposed`: `0.36.2` -> `0.37.2`
|
||||||
|
* `Ktor`: `1.6.5` -> `1.6.7`
|
||||||
|
* `Klock`: `2.4.8` -> `2.4.10`
|
||||||
|
|
||||||
## 0.8.9
|
## 0.8.9
|
||||||
|
|
||||||
* `Ktor`:
|
* `Ktor`:
|
||||||
|
@ -32,8 +32,7 @@ class EitherSerializer<T1, T2>(
|
|||||||
t1Serializer: KSerializer<T1>,
|
t1Serializer: KSerializer<T1>,
|
||||||
t2Serializer: KSerializer<T2>,
|
t2Serializer: KSerializer<T2>,
|
||||||
) : KSerializer<Either<T1, T2>> {
|
) : KSerializer<Either<T1, T2>> {
|
||||||
@ExperimentalSerializationApi
|
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
override val descriptor: SerialDescriptor = buildSerialDescriptor(
|
override val descriptor: SerialDescriptor = buildSerialDescriptor(
|
||||||
"TypedSerializer",
|
"TypedSerializer",
|
||||||
SerialKind.CONTEXTUAL
|
SerialKind.CONTEXTUAL
|
||||||
@ -44,8 +43,7 @@ class EitherSerializer<T1, T2>(
|
|||||||
private val t1EitherSerializer = EitherFirst.serializer(t1Serializer, t2Serializer)
|
private val t1EitherSerializer = EitherFirst.serializer(t1Serializer, t2Serializer)
|
||||||
private val t2EitherSerializer = EitherSecond.serializer(t1Serializer, t2Serializer)
|
private val t2EitherSerializer = EitherSecond.serializer(t1Serializer, t2Serializer)
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
override fun deserialize(decoder: Decoder): Either<T1, T2> {
|
override fun deserialize(decoder: Decoder): Either<T1, T2> {
|
||||||
return decoder.decodeStructure(descriptor) {
|
return decoder.decodeStructure(descriptor) {
|
||||||
var type: String? = null
|
var type: String? = null
|
||||||
@ -77,8 +75,7 @@ class EitherSerializer<T1, T2>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
override fun serialize(encoder: Encoder, value: Either<T1, T2>) {
|
override fun serialize(encoder: Encoder, value: Either<T1, T2>) {
|
||||||
encoder.encodeStructure(descriptor) {
|
encoder.encodeStructure(descriptor) {
|
||||||
when (value) {
|
when (value) {
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx2g
|
|||||||
kotlin_version=1.6.10
|
kotlin_version=1.6.10
|
||||||
kotlin_coroutines_version=1.6.0
|
kotlin_coroutines_version=1.6.0
|
||||||
kotlin_serialisation_core_version=1.3.2
|
kotlin_serialisation_core_version=1.3.2
|
||||||
kotlin_exposed_version=0.37.1
|
kotlin_exposed_version=0.37.2
|
||||||
|
|
||||||
ktor_version=1.6.7
|
ktor_version=1.6.7
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@ open class TypedSerializer<T : Any>(
|
|||||||
presetSerializers: Map<String, KSerializer<out T>> = emptyMap(),
|
presetSerializers: Map<String, KSerializer<out T>> = emptyMap(),
|
||||||
) : KSerializer<T> {
|
) : KSerializer<T> {
|
||||||
protected val serializers = presetSerializers.toMutableMap()
|
protected val serializers = presetSerializers.toMutableMap()
|
||||||
@ExperimentalSerializationApi
|
@OptIn(InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
override val descriptor: SerialDescriptor = buildSerialDescriptor(
|
override val descriptor: SerialDescriptor = buildSerialDescriptor(
|
||||||
"TypedSerializer",
|
"TypedSerializer",
|
||||||
SerialKind.CONTEXTUAL
|
SerialKind.CONTEXTUAL
|
||||||
@ -21,8 +20,7 @@ open class TypedSerializer<T : Any>(
|
|||||||
element("value", ContextualSerializer(kClass).descriptor)
|
element("value", ContextualSerializer(kClass).descriptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
override fun deserialize(decoder: Decoder): T {
|
override fun deserialize(decoder: Decoder): T {
|
||||||
return decoder.decodeStructure(descriptor) {
|
return decoder.decodeStructure(descriptor) {
|
||||||
var type: String? = null
|
var type: String? = null
|
||||||
@ -46,14 +44,12 @@ open class TypedSerializer<T : Any>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
protected open fun <O: T> CompositeEncoder.encode(value: O) {
|
protected open fun <O: T> CompositeEncoder.encode(value: O) {
|
||||||
encodeSerializableElement(descriptor, 1, value::class.serializer() as KSerializer<O>, value)
|
encodeSerializableElement(descriptor, 1, value::class.serializer() as KSerializer<O>, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExperimentalSerializationApi
|
@OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
|
||||||
@InternalSerializationApi
|
|
||||||
override fun serialize(encoder: Encoder, value: T) {
|
override fun serialize(encoder: Encoder, value: T) {
|
||||||
encoder.encodeStructure(descriptor) {
|
encoder.encodeStructure(descriptor) {
|
||||||
val valueSerializer = value::class.serializer()
|
val valueSerializer = value::class.serializer()
|
||||||
|
Loading…
Reference in New Issue
Block a user