How does one convert this query to hugSQL?
(SELECT '2023-01-02' + INTERVAL 1 DAY)
I tried
(next.jdbc/execute! (honey.sql/format {:select ["2023-01-02"]
:from [:+ :interval :1 :day]}))
but it doesn't work
class clojure.lang.PersistentVector cannot be cast to class clojure.lang.IPersistentMap
maybe
(honey.sql/format {:select [[[:+ "2023-01-02" [:interval 1 :day]]]]}
{:inline true})
;; => ["SELECT '2023-01-02' + INTERVAL 1 DAY"]that's interesting... Thanks a lot
The docs talk about :select needing extra nesting for expressions because it's:
:select [:col [:col :alias] [[:expr] :alias] [[:expr]]]
;=> SELECT col, col AS alias, EXPR() AS alias, EXPR()
So if you have just an expression, it's :select [[[:expr]]]