Public Vars

Back

upsert (clj)

(source)

function

(upsert clause) (upsert data clause)
Provided purely to ease migration from nilenso/honeysql-postgres this accepts a single clause, constructed from on-conflict, do-nothing or do-update-set, and where. Any of those are optional. This helper unpacks that clause and turns it into what HoneySQL 2.x expects, with any where clause being an argument to the do-update-set helper, along with the `:fields`. nilenso/honeysql-postgres: (-> ... (upsert (-> (on-conflict :col) do-nothing))) (-> ... (upsert (-> (on-conflict :col) (do-update-set :x) (where [:<> :x nil])))) HoneySQL 2.x: (-> ... (on-conflict :col) do-nothing) (-> ... (on-conflict :col) (do-update-set {:fields [:x] :where [:<> :x nil]})) Alternative structure for that second one: (-> ... (on-conflict :col) (do-update-set :x {:where [:<> :x nil]}))

Examples