Skip to content

Instantly share code, notes, and snippets.

@boonshift
Created February 7, 2019 04:30
Show Gist options
  • Save boonshift/aa7f777800a65f6c8fcba9972005b792 to your computer and use it in GitHub Desktop.
Save boonshift/aa7f777800a65f6c8fcba9972005b792 to your computer and use it in GitHub Desktop.
Simple data classes for demo.
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