honeysql

Bailey Kocin 2023-11-06T00:08:26.347259Z

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....

seancorfield 2023-11-06T00:13:45.799989Z

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?

seancorfield 2023-11-06T00:15:34.474149Z

You probably want :composite to build those tuples.

Bailey Kocin 2023-11-06T00:20:04.939659Z

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!

seancorfield 2023-11-06T00:23:17.421899Z

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

seancorfield 2023-11-06T00:23:54.364359Z

https://cljdoc.org/d/com.github.seancorfield/honeysql/2.5.1091/api/honey.sql.helpers lists all the helpers

seancorfield 2023-11-06T00:25:42.337289Z

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).

seancorfield 2023-11-06T00:26:12.584709Z

Ah yes, there's a whole section in the README about composite types https://cljdoc.org/d/com.github.seancorfield/honeysql/2.5.1091/doc/readme#composite-types

Bailey Kocin 2023-11-06T15:35:29.724679Z

Thanks!

p-himik 2023-11-06T09:52:27.201829Z

@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.

seancorfield 2023-11-06T16:52:11.875069Z

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