This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-29
Channels
- # babashka (4)
- # babashka-sci-dev (96)
- # beginners (79)
- # calva (26)
- # cider (5)
- # clerk (2)
- # clj-kondo (23)
- # clojars (14)
- # clojure (54)
- # clojure-europe (8)
- # clojure-sweden (3)
- # clojurescript (76)
- # datomic (12)
- # deps-new (6)
- # emacs (20)
- # events (3)
- # exercism (1)
- # fulcro (11)
- # funcool (12)
- # hugsql (14)
- # hyperfiddle (6)
- # kaocha (1)
- # lambdaisland (1)
- # lsp (22)
- # malli (1)
- # matcher-combinators (6)
- # nbb (6)
- # off-topic (128)
- # polylith (14)
- # re-frame (4)
- # reagent (1)
- # releases (4)
- # shadow-cljs (8)
- # tools-build (13)
- # tools-deps (13)
- # tree-sitter (5)
While it's totally doable with HugSQL and probably can be done a bit cleaner with snippets - I'd suggest looking at HoneySQL at this point, as you're heading towards that direction. I've used HugSQL for... 6 or 7 years at this point and started moving to HoneySQL because Postgres support improved so much in v2, that most if not all queries that I have can be rewritten 1-1. Once your queries are expressed as just data (it's Clojure after all) everything becomes so much composable and easier to reason about than multiple snippets, inline code in queries ( --~
etc). It's not perfect, but what you're trying to do - HoneySQL might work much better. Just my 2c
i'm trying hugsql because i found honeysql to occasionally feel really convoluted when i knew the plain SQL i wanted
though to be honest, that example i gave above of on conflict do update set isn't much better 😄
Yeah, there's no silver bullet, that's for sure. So to answer your question - snippets makes this more manageable - because you can lift the logic that you have within /**~ ... ~**/
block to your Clojure layer, and it all becomes somewhat more manageable
oh neat, so that could be something like -- :snip on-conflict-do-update-set and then just use it where you need it?
to be more specific, i don't think it was just the composability thing, it was that queries got littered around a bit over time
so i do genuinely like the idea of just forcing them to live outside of the clojure codebase