mirror of
https://github.com/penpot/penpot.git
synced 2026-09-07 12:40:12 +00:00
✨ Add the ability to check read-only state of connection
on the db ns helper; previously it only worked with datasource instances
This commit is contained in:
parent
d5bbc7b1aa
commit
90d48c1d30
@ -155,8 +155,18 @@
|
|||||||
(.isClosed ^HikariDataSource pool))
|
(.isClosed ^HikariDataSource pool))
|
||||||
|
|
||||||
(defn read-only?
|
(defn read-only?
|
||||||
[pool]
|
[pool-or-conn]
|
||||||
(.isReadOnly ^HikariDataSource pool))
|
(cond
|
||||||
|
(instance? HikariDataSource pool-or-conn)
|
||||||
|
(.isReadOnly ^HikariDataSource pool-or-conn)
|
||||||
|
|
||||||
|
(instance? Connection pool-or-conn)
|
||||||
|
(.isReadOnly ^Connection pool-or-conn)
|
||||||
|
|
||||||
|
:else
|
||||||
|
(ex/raise :type :internal
|
||||||
|
:code :invalid-connection
|
||||||
|
:hint "invalid connection provided")))
|
||||||
|
|
||||||
(defn create-pool
|
(defn create-pool
|
||||||
[cfg]
|
[cfg]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user