Closed snorremd closed 5 years ago
I jumped the gun and released 1.2.4 with the current change. We can always push out another release with the additional fixes.
I think the approach of checking whether db
is an instance of a connection is fine. Alternative would be to pass it explicitly using a separate key, but I don't think that adds much value in practice.
Thanks!
Let me know what you think about the approach @yogthos. This is still work in progress, some details to fix.
This commit adds code to let library users pass a java.sql.Connection or a javax.sql.DataSource instance in place of a Clojure map for the :db key in the configuration map.
The connect* function will make a type check on the db value. If the value is a DataSource it will get a connection from the data-source. If it is a Connection it will simply use that connection. If not, it will default to creating its own Connection as before.
TODO: Figure out how to test data-source based store creation.
See issue #172 .