This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-24
Channels
- # announcements (22)
- # babashka (33)
- # babashka-sci-dev (161)
- # beginners (25)
- # calva (57)
- # cider (6)
- # clara (6)
- # clerk (14)
- # clj-kondo (24)
- # clojars (10)
- # clojure (65)
- # clojure-austin (1)
- # clojure-conj (2)
- # clojure-europe (23)
- # clojure-miami (3)
- # clojure-nl (3)
- # clojure-norway (3)
- # clojure-uk (3)
- # clojurescript (28)
- # cursive (24)
- # datomic (136)
- # emacs (38)
- # graalvm (29)
- # graphql (3)
- # introduce-yourself (8)
- # jackdaw (4)
- # jobs-discuss (9)
- # malli (5)
- # nbb (36)
- # off-topic (11)
- # pathom (58)
- # polylith (2)
- # practicalli (1)
- # re-frame (5)
- # reagent (11)
- # releases (1)
- # remote-jobs (8)
- # sci (15)
- # shadow-cljs (31)
- # slack-help (2)
- # spacemacs (11)
- # sql (7)
- # tools-build (9)
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.
i went ahead and added the relevant bits for next.jdbc, but perhaps i should be doing that in the adapter itself?
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?
@U20LDTZBJ you'll need something like this: https://github.com/nomnom-insights/nomnom.utility-belt.sql/blob/master/src/utility_belt/sql/conv.clj#L24 - regardless if you're using HugSQL or not
(you just need the json bits of course, that namespace deals with more type conversion e.g. arrays and joda stuff)
I wound up adding the tips & tricks stuff into the adapter directly, and that fixed my issue.
You could use Toucan 2 to do that. https://github.com/camsaul/toucan2#define-transforms It can transform columns automatically for select
, insert!
, etc.