Fork me on GitHub
#sql
<
2023-01-24
>
d._.b20:01:12

I'm using hugsql and have a table with a jsonb column. I want to be able to insert {:foo 1 :bar {:baz :qux}} and select * from table where jsonb columns are serialized and deserialized as clojure edn.

d._.b21:01:26

i went ahead and added the relevant bits for next.jdbc, but perhaps i should be doing that in the adapter itself?

seancorfield22:01:51

I'm not sure how HugSQL is hooked up in the adapter so I can only point you to the next.jdbc docs Tips & Tricks > Working with JSON stuff. If that doesn't help, maybe ask in #C3EATG7EV directly?

lukasz22:01:46

(you just need the json bits of course, that namespace deals with more type conversion e.g. arrays and joda stuff)

d._.b23:01:27

I wound up adding the tips & tricks stuff into the adapter directly, and that fixed my issue.

Cam Saul01:02:03

You could use Toucan 2 to do that. https://github.com/camsaul/toucan2#define-transforms It can transform columns automatically for select, insert!, etc.