rrader
12/19/2018, 10:15 AMobject Users : Table() {
val id = varchar("id", 10).primaryKey() // Column<String>
val name = varchar("name", length = 50) // Column<String>
val cityId = (integer("city_id") references Cities.id).nullable() // Column<Int?>
}
Users.insert {
it[id] = "andrey"
it[name] = "Andrey"
it[cityId] = saintPetersburgId
}
how compiler know that it[id]
is valid and for example it[title]
is not valid?Alexander
12/19/2018, 10:23 AMinsert
is defined like:
body: T.(InsertStatement<Number>) -> Unit
where T: Table
Thus all properties of the Users
table are available inside the closure.