com.lightningkite.lightningserver.tasks.ActionHasOccurredFields.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-core Show documentation
Show all versions of server-core Show documentation
A set of tools to fill in/replace what Ktor is lacking in.
The newest version!
@file:UseContextualSerialization(Instant::class)
@file:OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
package com.lightningkite.lightningserver.tasks
import com.lightningkite.lightningdb.*
import com.lightningkite.lightningserver.core.LightningServerDsl
import com.lightningkite.lightningserver.serialization.Serialization
import kotlinx.coroutines.CoroutineScope
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseContextualSerialization
import kotlinx.serialization.serializer
import java.time.Instant
import kotlin.reflect.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.internal.GeneratedSerializer
import java.time.*
import java.util.*
fun prepareActionHasOccurredFields() {
ActionHasOccurred::_id.setCopyImplementation { original, value -> original.copy(_id = value) }
ActionHasOccurred::started.setCopyImplementation { original, value -> original.copy(started = value) }
ActionHasOccurred::completed.setCopyImplementation { original, value -> original.copy(completed = value) }
ActionHasOccurred::errorMessage.setCopyImplementation { original, value -> original.copy(errorMessage = value) }
}
val DataClassPath._id: DataClassPath get() = this[ActionHasOccurred::_id]
val DataClassPath.started: DataClassPath get() = this[ActionHasOccurred::started]
val DataClassPath.completed: DataClassPath get() = this[ActionHasOccurred::completed]
val DataClassPath.errorMessage: DataClassPath get() = this[ActionHasOccurred::errorMessage]
inline val ActionHasOccurred.Companion.path: DataClassPath get() = path()