Entity
Represents a type-safe wrapper over DynoMap that is bound to a specific DynoSchema.
An Entity ensures that all operations on the underlying map conform to the schema's structure, providing compile-time safety and automatic validation during deserialization.
Entities are immutable by default. For mutable operations, use MutableEntity.
Example:
// Define schema
object Person: EntitySchema("person") {
val name by dynoKey<String>()
val age by dynoKey<Int>()
}
// Create entity
val person = Person.new {
name set "Alex"
age set 30
}
// Access values in a type-safe way
println("Name: ${person[Person.name]}, Age: ${person[Person.age]}")Content copied to clipboard