This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-21
Channels
- # announcements (1)
- # architecture (392)
- # babashka (3)
- # beginners (1)
- # calva (2)
- # cider (1)
- # clojure (30)
- # clojure-denmark (2)
- # clojure-dev (9)
- # clojure-europe (13)
- # clojure-italy (2)
- # clojure-japan (17)
- # clojure-korea (8)
- # clojure-nl (1)
- # clojure-norway (74)
- # clojure-uk (3)
- # clojurescript (6)
- # code-reviews (8)
- # conjure (1)
- # data-science (1)
- # datascript (7)
- # datomic (1)
- # fulcro (1)
- # graalvm (9)
- # humbleui (3)
- # hyperfiddle (11)
- # leiningen (4)
- # lsp (7)
- # malli (7)
- # off-topic (57)
- # other-languages (9)
- # overtone (7)
- # shadow-cljs (30)
- # sql (15)
- # squint (3)
- # timbre (3)
- # vim (6)
I have a postgres table with a jsonb column that I want to return directly to clients. Is it possible to just pass the data through withouth next.jdbc touching it? we have this guy installed which I don't want to be executed in this case
(extend-protocol rs/ReadableColumn
PGobject
(read-column-by-label [^PGobject v _]
(<-pgobject v))
(read-column-by-index [^PGobject v _2 _3]
(<-pgobject v)))
Protocols are "global" so, no. You'd need to modify the protocol to not convert the specific column.
So without this guy, next.jdbc would return what? string? bytearray?
probably PGobject
Yup, plain ol' PGObject
...
I guess it depends on what you mean by "jsonb column that I want to return directly to clients"...?
You may be able to CAST()
it to something in SQL that avoided the PGObject
decoding, but returns something useful?
it's geojson, all nicely laid out for a maplib to consume in the browser.
I'll try casting it to bytes, thanks.
So instead of PGObject
or Clojure data, it sounds like you want regular JSON as a string?
yes, ideally a bytestream I can return as the response body
So, right now, you get a Clojure data structure and you have to convert that "back" to JSON for the response?
precisely