This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-11
Channels
- # announcements (3)
- # asami (4)
- # babashka (79)
- # babashka-sci-dev (47)
- # beginners (97)
- # biff (12)
- # calva (7)
- # clj-commons (3)
- # clj-kondo (22)
- # clj-on-windows (13)
- # cljdoc (31)
- # cljfx (2)
- # cljs-dev (1)
- # clojure (85)
- # clojure-austin (4)
- # clojure-dev (12)
- # clojure-europe (15)
- # clojure-italy (8)
- # clojure-nl (4)
- # clojure-uk (4)
- # community-development (19)
- # conjure (3)
- # core-typed (40)
- # cursive (9)
- # datahike (21)
- # datomic (1)
- # emacs (7)
- # exercism (2)
- # graalvm (20)
- # graphql (1)
- # honeysql (16)
- # jobs (1)
- # malli (2)
- # off-topic (3)
- # pathom (28)
- # pedestal (3)
- # polylith (7)
- # reitit (14)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (4)
- # shadow-cljs (21)
- # sql (21)
- # testing (8)
- # tools-deps (23)
- # vscode (8)
- # xtdb (38)
hey folks
I have an issue with a query of mine returning a org.postgresql.util.PGobject
i have a one to many relation
like this
customer <- order
my honeysql query looks like this
(-> (hh/select-distinct :customer :order)
(hh/from :customer)
(hh/left-join [:order] [:= :customer.id :order.customer_id])
(hh/where [:= :customer.id :?id])
(sql/format {:params {:id id}}))
the resulting sql query:
"SELECT DISTINCT customer, order FROM customer LEFT JOIN order ON customer.id = order.customer_id WHERE customer.id = ?"
this being the result when evaluated in the REPL
[{:customer #object[org.postgresql.util.PGobject 0x15feceb3 "(1,\"test customer\",\"jerry)"],
:order #object[org.postgresql.util.PGobject 0x680eec30 "(1,1,\"test order 1\")"]}
{:customer #object[org.postgresql.util.PGobject 0x701081a7 "(1,\"test customer\",\"jerry)"],
:order #object[org.postgresql.util.PGobject 0x13f2d1a6 "(2,1,\"test order 2\")"]}
{:customer #object[org.postgresql.util.PGobject 0x65c70b0b "(1,\"test customer\",\"jerry)"],
:order #object[org.postgresql.util.PGobject 0x51f2659f "(4,1,\"test order 4\)"]}]
what I obiously want to do is create a map from that like {:id 1 :desc "test customer" :name "jerry :tasks [{....} {....]}
but I have no clue how to do that
anyone able to help?
especially how to deal with the pgobject
Nevermind folks, found the answer with changing my query‘ select section