Vinicius Araujo
09/24/2019, 11:55 PMtapac
09/25/2019, 5:45 AMVinicius Araujo
09/25/2019, 11:59 AMid
name
age
I would like to listen to a PATCH requisition with val property, val newValue
and perform an update on said property`s table. like if (property == "name") then [update name]
, but maybe using generics insteadtapac
09/25/2019, 1:49 PMVinicius Araujo
09/25/2019, 3:02 PMfun patchUser(property: String, newValue: Any) = transaction {
Users.update {
it[<property>] = newValue
}
}
tapac
09/25/2019, 3:14 PMproperty
and newValue
are come from?Vinicius Araujo
09/25/2019, 5:07 PMShawn A
09/25/2019, 5:19 PMVinicius Araujo
09/25/2019, 5:57 PMfun patchUser(patchUser: PatchUser) = transaction {
Users.update {
if(patchUser.name) != null
it[name] = patchUser.name
if(etc...)
}
}
tapac
09/27/2019, 9:38 AM