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

commonMain.maryk.test.models.ValueMarykObject.kt Maven / Gradle / Ivy

Go to download

Maryk is a Kotlin Multiplatform library which helps you to store, query and send data in a structured way over multiple platforms. The data store stores any value with a version, so it is possible to request only the changed data or live listen for updates.

The newest version!
package maryk.test.models

import kotlinx.datetime.LocalDate
import maryk.core.models.ValueDataModel
import maryk.core.properties.definitions.date
import maryk.core.properties.definitions.number
import maryk.core.properties.types.ValueDataObject
import maryk.core.properties.types.numeric.SInt32
import maryk.core.values.ObjectValues

data class ValueMarykObject(
    val int: Int = 5,
    val date: LocalDate = LocalDate(2000, 5, 12)
) : ValueDataObject(toBytes(int, date)) {
    companion object : ValueDataModel(ValueMarykObject::class) {
        val int by number(
            index = 1u,
            getter = ValueMarykObject::int,
            type = SInt32,
            default = 5
        )
        val date by date(
            index = 2u,
            getter = ValueMarykObject::date,
            default = LocalDate(2000, 5, 12)
        )

        override fun invoke(values: ObjectValues) = ValueMarykObject(
            int = values(1u),
            date = values(2u)
        )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy