Fork me on GitHub
#honeysql
<
2021-06-02
>
Teemu Kaukoranta13:06:43

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 Kaukoranta13:06:39

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

seancorfield15:06:25

types/as-other is next.jdbc not honeysql

Teemu Kaukoranta15:06:06

ah, that explains it

Teemu Kaukoranta15:06:36

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/

seancorfield15:06:47

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