mirror of
https://github.com/penpot/penpot.git
synced 2025-05-11 09:16:37 +02: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
1 changed files with 12 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue