This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-26
Channels
- # announcements (18)
- # aws (17)
- # babashka (19)
- # beginners (141)
- # calva (73)
- # cider (4)
- # clj-kondo (13)
- # cljs-dev (2)
- # clojure (97)
- # clojure-europe (6)
- # clojure-italy (5)
- # clojure-nl (1)
- # clojure-spec (25)
- # clojure-sweden (2)
- # clojure-uk (25)
- # clojured (3)
- # clojurescript (63)
- # core-typed (6)
- # cursive (23)
- # data-science (4)
- # datomic (74)
- # fulcro (19)
- # graalvm (18)
- # graphql (3)
- # hoplon (63)
- # jackdaw (1)
- # juxt (23)
- # london-clojurians (3)
- # meander (7)
- # off-topic (23)
- # om (1)
- # pathom (13)
- # pedestal (2)
- # perun (2)
- # re-frame (38)
- # reagent (3)
- # reitit (24)
- # shadow-cljs (91)
- # spacemacs (14)
- # sql (4)
- # tools-deps (8)
- # vim (3)
Hello @seancorfield
Did you consider next.jdbc API for with-transaction
where sym
shadows name of transactable
?
; Current API
(with-open [conn (jdbc/get-connection my-datasource)]
(jdbc/with-transaction [tx conn]
(jdbc/execute! tx ...))) ; what is allowed to do with `conn` here?
; Alternative - the lexical scope of `conn` is changed
(with-open [conn (jdbc/get-connection my-datasource)]
(jdbc/with-transaction [conn]
(jdbc/execute! conn ...))) ; outer `conn` not accessible here
You can already do
(jdbc/with-transaction [conn conn] ,,,)
if you want to hide conn
inside the lexical scope so I see no reason to add a special case syntax for this. Note that in the general case the transactable
can be a DataSource
or even a db-spec.@dharrigan Let me know how that works. I had a look at how the nilenso extensions work and saw a bunch of numbers that presumably deal with precedence and clause ordering. I kind of shied away of HoneySQL at that point.
We had a nice argument in the team the other day, should the "sugar" help you in the easy case or the hard case? We'll investigate Walkable next since it seems to lift the concern from SQL to another level, whereas HoneySQL still asks you to write SQL, just in another format...
You can already do
(jdbc/with-transaction [conn conn] ,,,)
if you want to hide conn
inside the lexical scope so I see no reason to add a special case syntax for this. Note that in the general case the transactable
can be a DataSource
or even a db-spec.