我在 Kotlin Exposed 文档中找不到如何使用外键插入记录的方法:
object DocumentTable : IntIdTable() {
val description = varchar("desc", 200)
}
object TransactionTable : IntIdTable() {
val amount = long("amount")
val documentId = reference("documentId", DocumentTable.id)
}
fun createTrans(amount: Long, document: Document) {
transaction {
TransactionTable.insert {
it[this.amount] = amount
it[this.documentId] = ?????????????
}
}
}