hugsql

jeffmk 2021-01-28T23:06:26.001100Z

HugSQL makes it clean to get ad-hoc fields using SELECT:

select :i*:cols from characters
where id in (:v*:ids)
But is there anything cleaner than this for ad-hoc UPDATE? https://www.hugsql.org/#using-expressions That UPDATE expression is very generic, supporting any specified table/etc. Seems like we are missing a level of abstraction here in between the two. I am looking for something more resembling the first statement if possible.

curtis.summers 2021-01-28T23:19:13.003400Z

The level of abstraction you’re looking for is already available in the underlying next.jdbc or clojure.java.jdbc libraries with the update! function. So, while HugSQL lets you build any complex Clojure expression you want, you may find it easier to use the underlying library’s features.

jeffmk 2021-01-28T23:23:18.004100Z

Thanks, @curtis.summers, I will check that out!