This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-08
Channels
- # announcements (10)
- # beginners (53)
- # calva (22)
- # clj-kondo (21)
- # cljs-dev (1)
- # clojure (18)
- # clojure-europe (2)
- # clojure-filipino (1)
- # clojure-indonesia (1)
- # clojure-my (1)
- # clojure-seattle (6)
- # clojure-sg (1)
- # clojurescript (60)
- # code-reviews (3)
- # conjure (1)
- # cursive (1)
- # datomic (2)
- # figwheel-main (1)
- # fulcro (2)
- # gratitude (1)
- # honeysql (35)
- # lsp (6)
- # malli (5)
- # meander (11)
- # off-topic (27)
- # other-languages (3)
- # play-clj (1)
- # portal (31)
- # sql (13)
- # xtdb (5)
That inspired another Friday afternoon horror 🙂
dev=> (let [id 123] (sql/format (assoc-in '{update table set {foo (coalesce submitted_at (now))} where [= id 0]} '[where 2] id)))
["UPDATE table SET foo = COALESCE(submitted_at, NOW()) WHERE id = ?" 123]
not brittle at all
@seancorfield where would this live in honeysql? https://github.com/seancorfield/honeysql/issues/377
it feels like honey.sql itself, not honey.sql.helpers, but I don't see anything special like this in there
or at least nothing seems similar enough to my eyes that I have an example of how you'd like it set up
oh wow, it's late
I'm gonna bounce then
Yeah, I think honey.sql
is the right place. I'll have to give the name some thought (naming is hard). next.jdbc.sql.builder
has a similar construct called by-keys
but that's a generic constructor for several map-to-SQL-params clauses.
Since it'll be mostly used via honey.sql :as sql
I suspect, maybe sql/condition
? Maybe sql/map->=
or sql/map=
or similar?