com.lightningkite.lightningserver.db.testmodels.UniqueComboClassFields.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(UUID::class)
@file:OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)
package com.lightningkite.lightningserver.db.testmodels
import com.lightningkite.lightningdb.*
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseContextualSerialization
import java.util.*
import kotlin.reflect.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.internal.GeneratedSerializer
import java.time.*
fun prepareUniqueComboClassFields() {
UniqueComboClass::_id.setCopyImplementation { original, value -> original.copy(_id = value) }
UniqueComboClass::unique1.setCopyImplementation { original, value -> original.copy(unique1 = value) }
UniqueComboClass::uniqueSet1.setCopyImplementation { original, value -> original.copy(uniqueSet1 = value) }
UniqueComboClass::uniqueSet2.setCopyImplementation { original, value -> original.copy(uniqueSet2 = value) }
}
val DataClassPath._id: DataClassPath get() = this[UniqueComboClass::_id]
val DataClassPath.unique1: DataClassPath get() = this[UniqueComboClass::unique1]
val DataClassPath.uniqueSet1: DataClassPath get() = this[UniqueComboClass::uniqueSet1]
val DataClassPath.uniqueSet2: DataClassPath get() = this[UniqueComboClass::uniqueSet2]
inline val UniqueComboClass.Companion.path: DataClassPath get() = path()