All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.caesarealabs.rpc4k.runtime.implementation.serializers.DateSerializers.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("FunctionName")

package com.caesarealabs.rpc4k.runtime.implementation.serializers

import kotlinx.datetime.Instant
import kotlinx.serialization.KSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder


///**
// * We serialize instant as an iso string
// */
//public object InstantIsoSerializer : KSerializer {
//    override val descriptor: SerialDescriptor = String.serializer().descriptor
//
//    override fun deserialize(decoder: Decoder): Instant = Instant.parse(decoder.decodeString())
//
//    override fun serialize(encoder: Encoder, value: Instant): Unit = encoder.encodeString(value.toString())
//}

//import java.time.Instant
//import java.time.ZonedDateTime
//
//
//
///**
// * We serialize instant as an iso string
// */
//public object InstantIsoSerializer : KSerializer {
//    override val descriptor: SerialDescriptor = String.serializer().descriptor
//
//    override fun deserialize(decoder: Decoder): Instant = Instant.parse(decoder.decodeString())
//
//    override fun serialize(encoder: Encoder, value: Instant): Unit = encoder.encodeString(value.toString())
//}
//
//
///**
// * We serialize ZonedDateTime as an iso string
// */
//public object ZonedDateTimeIsoSerializer : KSerializer {
//    override val descriptor: SerialDescriptor = String.serializer().descriptor
//
//    override fun deserialize(decoder: Decoder): ZonedDateTime = ZonedDateTime.parse(decoder.decodeString())
//
//    override fun serialize(encoder: Encoder, value: ZonedDateTime): Unit = encoder.encodeString(value.toString())
//}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy