Fork me on GitHub

Hi, I have this HugSql query:

-- :name find-friendships :? :*
-- :doc find all friends for a given user
select (, u.first_name, u.last_name) from friendships
join users u on = 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 query


Why the parentheses around your selected columns? This is creating a tuple, I think. Can you change your SQL to select, u.first_name, u.last_name from…?


That worked… Thanks!


You’re welcome!


Love it when it’s something simple like that