commonMain.maryk.test.models.EmbeddedMarykModel.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 maryk.core.models.DataModel
import maryk.core.properties.definitions.embed
import maryk.core.properties.definitions.string
import maryk.core.values.Values
object EmbeddedMarykModel : DataModel(
reservedIndices = listOf(999u),
reservedNames = listOf("reserved"),
) {
val value by string(
index = 1u
)
val model by embed(
index = 2u,
required = false,
dataModel = { EmbeddedMarykModel }
)
val marykModel by embed(
index = 3u,
required = false,
dataModel = { TestMarykModel }
)
operator fun invoke(
value: String,
model: Values? = null,
marykModel: Values? = null
) =
create(
this.value with value,
this.model with model,
this.marykModel with marykModel
)
}