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

com.lightningkite.lightningserver.metrics.MetricSpanStatsFields.kt Maven / Gradle / Ivy

The newest version!
@file:UseContextualSerialization(Instant::class, Duration::class)
@file:OptIn(ExperimentalSerializationApi::class, InternalSerializationApi::class)

package com.lightningkite.lightningserver.metrics

import com.lightningkite.lightningdb.*
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseContextualSerialization
import java.time.Duration
import java.time.Instant
import kotlin.math.max
import kotlin.math.min
import kotlin.reflect.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.internal.GeneratedSerializer
import java.time.*
import java.util.*

fun prepareMetricSpanStatsFields() {
    MetricSpanStats::_id.setCopyImplementation { original, value -> original.copy(_id = value) }
    MetricSpanStats::endpoint.setCopyImplementation { original, value -> original.copy(endpoint = value) }
    MetricSpanStats::type.setCopyImplementation { original, value -> original.copy(type = value) }
    MetricSpanStats::timeStamp.setCopyImplementation { original, value -> original.copy(timeStamp = value) }
    MetricSpanStats::timeSpan.setCopyImplementation { original, value -> original.copy(timeSpan = value) }
    MetricSpanStats::min.setCopyImplementation { original, value -> original.copy(min = value) }
    MetricSpanStats::max.setCopyImplementation { original, value -> original.copy(max = value) }
    MetricSpanStats::sum.setCopyImplementation { original, value -> original.copy(sum = value) }
    MetricSpanStats::count.setCopyImplementation { original, value -> original.copy(count = value) }
}
val  DataClassPath._id: DataClassPath get() = this[MetricSpanStats::_id]
val  DataClassPath.endpoint: DataClassPath get() = this[MetricSpanStats::endpoint]
val  DataClassPath.type: DataClassPath get() = this[MetricSpanStats::type]
val  DataClassPath.timeStamp: DataClassPath get() = this[MetricSpanStats::timeStamp]
val  DataClassPath.timeSpan: DataClassPath get() = this[MetricSpanStats::timeSpan]
val  DataClassPath.min: DataClassPath get() = this[MetricSpanStats::min]
val  DataClassPath.max: DataClassPath get() = this[MetricSpanStats::max]
val  DataClassPath.sum: DataClassPath get() = this[MetricSpanStats::sum]
val  DataClassPath.count: DataClassPath get() = this[MetricSpanStats::count]
inline val MetricSpanStats.Companion.path: DataClassPath get() = path()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy