Created
February 7, 2019 04:30
-
-
Save boonshift/aa7f777800a65f6c8fcba9972005b792 to your computer and use it in GitHub Desktop.
Simple data classes for demo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.fasterxml.jackson.databind.ObjectMapper | |
import org.jetbrains.exposed.dao.EntityID | |
import org.jetbrains.exposed.dao.IntEntity | |
import org.jetbrains.exposed.dao.IntEntityClass | |
import org.jetbrains.exposed.dao.IntIdTable | |
val jsonMapper = ObjectMapper() | |
object Customers : IntIdTable() { | |
val name = varchar("name", 50) | |
val misc = jsonb("misc", Map::class.java, jsonMapper) | |
} | |
class Customer(id: EntityID<Int>) : IntEntity(id) { | |
companion object : IntEntityClass<Customer>(Customers) | |
var name by Customers.name | |
var misc by Customers.misc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment