mirror of
https://github.com/penpot/penpot.git
synced 2025-05-12 13:56:37 +02:00
✨ Improve with-atomic macro to accept cfg
This commit is contained in:
parent
d268ff2952
commit
27fb4c7ed9
3 changed files with 22 additions and 2 deletions
|
@ -218,7 +218,13 @@
|
|||
|
||||
(defmacro with-atomic
|
||||
[& args]
|
||||
`(jdbc/with-transaction ~@args))
|
||||
(if (symbol? (first args))
|
||||
(let [cfgs (first args)
|
||||
body (rest args)]
|
||||
`(jdbc/with-transaction [conn# (::pool ~cfgs)]
|
||||
(let [~cfgs (assoc ~cfgs ::conn conn#)]
|
||||
~@body)))
|
||||
`(jdbc/with-transaction ~@args)))
|
||||
|
||||
(defn open
|
||||
[pool]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue