Fork me on GitHub

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]

Cora (she/her)00:01:04

not brittle at all

Cora (she/her)00:01:50

it feels like honey.sql itself, not honey.sql.helpers, but I don't see anything special like this in there

Cora (she/her)00:01:31

or at least nothing seems similar enough to my eyes that I have an example of how you'd like it set up

Cora (she/her)00:01:47

oh wow, it's late

Cora (she/her)00:01:52

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?

Cora (she/her)00:01:03


👍 1