Slide 22
Slide 22 text
Google Home + IFTTT
object Computers : IntIdTable() {
val hostName = varchar("hostname", 50).index()
val macAddr = varchar("mac_addr", 50)
}
class Computer(id: EntityID) : IntEntity(id) {
companion object : IntEntityClass(Computers)
var hostname by Computers.hostName
var macAddr by Computers.macAddr
}
fun findByHostName(hostName: String?): Computer? {
return transaction {
Computer.find {
Computers.hostName eq hostName
}.firstOrNull()
}
}
object Computers : IntIdTable() {
val hostName = varchar("hostname", 50).index()
val name = varchar("name", 50)
val macAddr = varchar("mac_addr", 50)
}
class Computer(id: EntityID) : IntEntity(id) {
companion object : IntEntityClass(Computers)
var hostname by Computers.hostName
var name by Computers.name
var macAddr by Computers.macAddr
}
fun findByHostName(hostName: String?): Computer? {
return transaction {
Computer.find {
Computers.hostName eq hostName
}.firstOrNull()
}
}
fun findByName(name: String?): Computer? {
return transaction {
Computer.find {
Computers.name eq name
}.firstOrNull()
}
}