Fork me on GitHub
#honeysql
<
2023-11-06
>
Bailey Kocin00:11:26

Is there a better channel to ask honeysql questions? I want to know if I can manage to create a delete like so

delete from table where (first, second) in ((1,2), (2,1))
by just using the helpers and not having to dip into raw sql.... I know this tuple syntax works in postgres at least, not sure if its common either....

seancorfield00:11:45

This is the HoneySQL channel so you're in the right place. What have you tried? How close did you get to what you wanted?

seancorfield00:11:34

You probably want :composite to build those tuples.

Bailey Kocin00:11:04

Well I did not the :composite keyword/helper existed so this is a start, I was just using the raw syntax and was wondering if something like this existed so thanks!

seancorfield00:11:17

(-> (delete-from :table)
      (where [:in (composite :first :second)
              [(composite 1 2) (composite 2 1)]])
      (format))

seancorfield00:11:42

composite is mentioned in https://cljdoc.org/d/com.github.seancorfield/honeysql/2.5.1091/doc/getting-started#functional-helpers and there's an example in the README too (according to that section of the Getting Started doc).

p-himik09:11:27

@seancorfield In https://github.com/seancorfield/next-jdbc/commit/3a6539f3e2704ad79a7b070c4ab13d8671adf155 you have switched from com.opentable.components/otj-pg-embedded to io.zonky.test/embedded-postgres, probably because the former wasn't maintained. But seems that the former has picked up the pace. I wonder - have you re-evaluated otj-pg-embedded any time recently? Trying to decide which one to use in my projects.

seancorfield16:11:11

Since zonky seemed to be continuously maintained I haven't looked at alternatives. I don't use postgresql so this is "just" a testing convenience for me.

👍 1