This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-08
Channels
- # announcements (22)
- # aws (4)
- # babashka (25)
- # beginners (78)
- # calva (9)
- # cider (22)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (27)
- # clojure-australia (7)
- # clojure-europe (22)
- # clojure-nl (15)
- # clojure-uk (26)
- # clojurescript (20)
- # datahike (3)
- # datomic (15)
- # events (1)
- # helix (5)
- # honeysql (4)
- # kaocha (1)
- # malli (1)
- # meander (1)
- # off-topic (84)
- # pathom (14)
- # re-frame (3)
- # reagent (28)
- # reitit (6)
- # sci (1)
- # shadow-cljs (78)
- # tools-deps (30)
Hi there! I’m wondering if there’s any way to access a composite type (as in https://www.postgresql.org/docs/current/rowtypes.html#ROWTYPES-ACCESSING ) with honeysql? Re the linked example: as I’m not able to use :(item).name
, is there any alternative way to express (item).name
? (I could only find how to compose a composite type in the docs; any way to decompose it would be useful.)
I suspect (keyword "(item)" "name")
would work (but that's pretty ugly). I'd probably define :.
as special syntax:
dev=> (sql/register-fn! :. (fn [_ [x y]] [(str "(" (sql/format-entity x) ")." (sql/format-entity y))]))
...
dev=> (sql/format-expr [:. :item :name])
["(item).name"]
Maybe (sql/format-expr x)
if that can be an expression -- but that returns [sql & params]
so you'd need a more complex formatted...👍 4
@marcus.josefsson ☝️:skin-tone-2: Does that help?