I can change a field of a row with entryId
in Esqueleto like this:
update $ \entry -> do
set entry [ EntryFoo =. val bar ]
where_ (entry ^. EntryId ==. val entryId)
However, writing it all the time gets annoying. I'd like to be able to write something like this:
updateById entryId $ \entry ->
set entry [ EntryFoo =. val bar ]
I tried to write this helper by myself, but found that I don't know how to write ^. EntryId
in a generic way (i.e. a way that would work for any entry types). Is it possible? Or am I missing something and updateById
already exists in Esqueleto?