0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05: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:
Andrey Antukh 2023-03-31 12:35:16 +02:00 committed by Alonso Torres
parent d5bbc7b1aa
commit 90d48c1d30

View file

@ -155,8 +155,18 @@
(.isClosed ^HikariDataSource pool))
(defn read-only?
[pool]
(.isReadOnly ^HikariDataSource pool))
[pool-or-conn]
(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
[cfg]