commonMain.maryk.test.models.TestValueObject2.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of maryk-testmodels Show documentation
Show all versions of maryk-testmodels Show documentation
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.LocalDateTime
import maryk.core.models.ValueDataModel
import maryk.core.properties.definitions.dateTime
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 TestValueObject2(
val int: Int,
val dateTime: LocalDateTime,
) : ValueDataObject(toBytes(int, dateTime)) {
companion object : ValueDataModel(TestValueObject2::class) {
val int by number(
1u,
TestValueObject2::int,
type = SInt32,
maxValue = 6
)
val dateTime by dateTime(2u, TestValueObject2::dateTime)
override fun invoke(values: ObjectValues) = TestValueObject2(
int = values(1u),
dateTime = values(2u)
)
}
}