LocalDateTimeWithInfinitySerializer

object LocalDateTimeWithInfinitySerializer : KSerializer<LocalDateTime>

Writes a LocalDateTime the way a timestamp column holds it, so that (payload->>'taken')::timestamp reads back what was put in.

LocalDateTime.Companion.DISTANT_FUTURE and LocalDateTime.Companion.DISTANT_PAST mean infinity and -infinity in a column, and the default serializer writes them out in full at a year a timestamp cannot hold, that type reaching 294276 AD. Outside the markers, every year outside 0001..9999 is spelled in a way PostgreSQL will not read - see PgDateText.

Registered contextually by octaviusSerializersModule; @Contextual on the property is what selects it.

Properties

Link copied to clipboard
open override val descriptor: SerialDescriptor

Functions

Link copied to clipboard
open override fun deserialize(decoder: Decoder): LocalDateTime
Link copied to clipboard
open override fun serialize(encoder: Encoder, value: LocalDateTime)