https://kotlinlang.org logo
#ktor
Title
# ktor
p

paulex

01/08/2020, 10:02 AM
Copy code
override fun modify(item: User): CompletionStage<User> {
    return supplyAsync {
        transaction {
            Users.update({ Users.id eq item.id }) {
                it[name] = item.name
                it[gender] = item.gender
                it[first_name] = item.firstName;
            }
        }
    }.thenApply { return@thenApply item }
}
Is there a way to simplify an update transaction on object properties, i feel it is repetitive to keep on writing : it[name] = item.name it[gender] = item.gender ?
s

SackCastellon

01/08/2020, 12:09 PM
Assuming you are using Exposed, you should probably ask this in the #exposed channel
p

paulex

01/08/2020, 12:18 PM
Alright... Thanks.
2 Views