This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-06
Channels
- # aleph (1)
- # announcements (2)
- # beginners (109)
- # calva (48)
- # cider (25)
- # clj-kondo (38)
- # cljdoc (13)
- # clojure (203)
- # clojure-europe (23)
- # clojure-gamedev (3)
- # clojure-nl (3)
- # clojure-uk (7)
- # conjure (2)
- # data-science (1)
- # datalog (2)
- # datomic (7)
- # deps-new (16)
- # depstar (2)
- # docker (2)
- # fulcro (67)
- # graalvm (58)
- # honeysql (16)
- # java (2)
- # jobs (2)
- # jobs-discuss (2)
- # kaocha (4)
- # lsp (82)
- # malli (23)
- # off-topic (35)
- # polylith (18)
- # practicalli (5)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (15)
- # sql (17)
- # timbre (1)
- # tools-deps (24)
- # vim (20)
- # xtdb (9)
Added clojure-mode, syntax highlighting, and permalinks to https://www.john-shaffer.com/honeysql/
I'd like to add multiple versions in a dropdown (once it's relevant), so the permalinks will stay perma
@jshaffer2112 Is this something you're planning to keep online and maintain now? Just wondering whether to add it to the docs since I think it's a great resource!
Yes, I'll keep it maintained. It'd be nice to have it in the docs
I've added links to the README and the Getting Started section so it'll be part of the next release's documentation (2.0 "gold"). Thank again for this @jshaffer2112!
I use it all the time
Cool. I've made a note to remind me to add it to the docs. Thank you!
[honeysql-postgres.helpers :as psqlh]
(defn upsert!
[table record constraint-name where-clause]
(-> (insert-into table)
(values [record])
(where* where-clause)
(psqlh/upsert (-> (psqlh/on-conflict-constraint constraint-name)
(psqlh/do-update-set :id
:tag)
))
sql/format)
)
Can somebody suggest how I can make this function generic and remove the coupling with :id and :tag . I need to fetch the keys from record.
Record looks like this :This is the input format for psqlh/do-update-set
(defhelper do-update-set [m args]
(assoc m :do-update-set (sqlh/collify args)))
@aditi.mishra That's for the nilenso library?
I suspect you could do something like (assoc :do-update-set (into [] (keys record)))
depending on exactly what that do-update-set
helper uses as the underlying key...