This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-02
Channels
- # announcements (1)
- # asami (89)
- # aws (10)
- # babashka (41)
- # beginners (71)
- # calva (25)
- # cider (3)
- # clj-kondo (65)
- # cljdoc (15)
- # cljs-dev (3)
- # cljsrn (8)
- # clojure (56)
- # clojure-europe (44)
- # clojure-italy (1)
- # clojure-nl (2)
- # clojure-uk (48)
- # clojured (7)
- # clojurescript (17)
- # conjure (6)
- # cursive (3)
- # datomic (9)
- # emacs (11)
- # events (3)
- # fulcro (3)
- # helix (3)
- # honeysql (7)
- # hugsql (6)
- # introduce-yourself (2)
- # jobs (2)
- # kaocha (4)
- # luminus (1)
- # nrepl (2)
- # off-topic (10)
- # pathom (7)
- # philosophy (3)
- # polylith (27)
- # reagent (18)
- # reitit (3)
- # remote-jobs (7)
- # reveal (3)
- # shadow-cljs (9)
- # slack-help (5)
- # tools-deps (9)
- # vim (48)
Hi, I have this HugSql query:
-- :name find-friendships :? :*
-- :doc find all friends for a given user
select (u.id, u.first_name, u.last_name) from friendships
join users u on u.id = friendships.user2
where user1 = :user_id
Is there a way to get the data back as a map instead of {:row "(someid, name, lastName)"}
-- Let's specify some columns with the
-- identifier list parameter type :i* and
-- use a value list parameter type :v* for SQL IN()
-- :name characters-by-ids-specify-cols :? :*
-- :doc Characters with returned columns specified
select :i*:cols from characters
where id in (:v*:ids)
I’ve seen this snippet in the docs, but is there a way to specify the columns that isn’t dynamic? I never need a variable list of columns for this queryWhy the parentheses around your selected columns? This is creating a tuple, I think. Can you change your SQL to select u.id, u.first_name, u.last_name from…
?
You’re welcome!