honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
Teemu Kaukoranta 2021-06-02T13:22:43.011900Z

How do you cast strings to enums with honeysql? Found some discussion from the slack archive, but I can't figure out what is the types/as-other that is being referenced. https://clojurians-log.clojureverse.org/honeysql/2021-04-14

Teemu Kaukoranta 2021-06-02T13:36:39.012Z

Well, I guess I can just add the casting stuff to the string myself

seancorfield 2021-06-02T15:00:25.012500Z

types/as-other is next.jdbc not honeysql

Teemu Kaukoranta 2021-06-02T15:19:06.012700Z

ah, that explains it

Teemu Kaukoranta 2021-06-02T15:20:36.012900Z

I had to do this a bit differently than I at first thought anyway. In case someone finds this message later, here's the approach I used https://www.bevuta.com/en/blog/using-postgresql-enums-in-clojure/

seancorfield 2021-06-02T15:50:47.013300Z

Yeah, if you’re using clojure.java.jdbc, you need to extend ISQLValue. That’s one of the nice things about next.jdbc: you can use any of the built-in JDBC types as “hints”, via the next.jdbc.types namespace: https://cljdoc.org/d/com.github.seancorfield/next.jdbc/1.2.659/api/next.jdbc.types