Fork me on GitHub
#honeysql
<
2021-05-14
>
Lennart Buit09:05:27

Can you express nested functions in honeysql, say sum(coalesce(a, b))?

dcj15:05:37

Would [:sum [:coalesce a b]] work?

seancorfield16:05:51

dev=> (sql/format-expr [:sum [:coalesce :a :b]])
["SUM(COALESCE(a, b))"]
dev=> (sql/format {:select [ [[:sum [:coalesce :a :b]] :c] ]})
["SELECT SUM(COALESCE(a, b)) AS c"]
dev=> 

💯 5