I currently have a patch endpoint which allows users to supply a field/value to update. I handle the update for a single named field/value with the following query.
val query = sqlu"""UPDATE issues
SET #$column=$value,
UPDATED_AT=NOW(),
VERSION=VERSION+1
WHERE ID=$issueId
LIMIT 1"""
Now I need to extend the expoint to allow multiple updates in a single http request. So the user can supply for example two
[
{"op":"update","field":"name","value":"test"}, {"op":"update","field":"age","value":"99"}
]
I have managed to make this work by essentially doing the query above twice but that is obviously two hits to the DB.
Is there a way to update multiple unknown column/values in slick?