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

com.lightningkite.lightningdb.EntryChange.kt Maven / Gradle / Ivy

@file:SharedCode
package com.lightningkite.lightningdb

import com.lightningkite.khrysalis.Equatable
import com.lightningkite.khrysalis.IsCodableAndHashable
import com.lightningkite.khrysalis.JsName
import com.lightningkite.khrysalis.SharedCode
import kotlinx.serialization.Serializable
import java.util.ArrayList

@Serializable
data class EntryChange(
    val old: T? = null,
    val new: T? = null
) {
}

// This will not convert well. Manually add the type argument to the return EntryChange on the swift side. "EntryChange"
inline fun  EntryChange.map(mapper: (T)->B): EntryChange {
    return EntryChange(old?.let(mapper), new?.let(mapper))
}