I`d like to use Exposed in Ktor. The simplest question is how can I get an Entity from Query options?
Such as these code:
/**
* get when exist
*/
fun checkExist(phone: String): DbUser? {
return transaction(db) {
addLogger(StdOutSqlLogger)
DbUser
.select { DbUser.phoneNumber eq phone }
.firstOrNull()
.??? // how to converter ResultRow to Entity ?
}
}
I want to check whether the user existing when login and get info when existing. But I can only get the reuslt with type ResultRow, How can I converter it to DbUser object?
I got a way in this Kotlin exposed DSL Query mapping but it is so clumsy and time wasting. How can I accomplish it easily?
Tableclass and a separatedata classthat is to be used as DAO. At this moment there are no options to have this mapping be performed byexposedautomatically.