Rename jdbc-url to ->pool

This commit is contained in:
Sean Corfield 2019-07-18 11:01:55 -07:00
parent e76b382016
commit b1b2f13ebb
4 changed files with 6 additions and 6 deletions

View file

@ -6,7 +6,7 @@ Only accretive/fixative changes will be made from now on.
The following changes have been committed to the **master** branch since the 1.0.2 release:
* Address #48 by adding `next.jdbc.connection/jdbc-url` and showing HikariCP and c3p0 connection pooling (so far it's just tests).
* Address #48 by adding `next.jdbc.connection/->pool` and showing HikariCP and c3p0 connection pooling (so far it's just tests).
## Stable Builds

View file

@ -192,7 +192,7 @@
(throw (ex-info (str "Unknown dbtype: " dbtype) db-spec)))
[url etc]))
(defn jdbc-url
(defn ->pool
"Given a connection pooling class and a database spec, return an connection
pool object built from the database spec."
[clazz db-spec]

View file

@ -114,7 +114,7 @@
:opts (s/? ::opts-map)))
:body (s/* any?)))
(s/fdef connection/jdbc-url
(s/fdef connection/->pool
:args (s/cat :clazz #(instance? Class %)
:db-spec ::db-spec-map))
@ -192,7 +192,7 @@
`jdbc/execute-one!
`jdbc/transact
`jdbc/with-transaction
`connection/jdbc-url
`connection/->pool
`prepare/execute-batch!
`prepare/set-parameters
`sql/insert!

View file

@ -106,10 +106,10 @@
(with-open [con (p/get-connection db {})]
(is (instance? java.sql.Connection con))))
(testing "connection via HikariCP"
(with-open [con (p/get-connection (c/jdbc-url com.zaxxer.hikari.HikariDataSource db)
(with-open [con (p/get-connection (c/->pool com.zaxxer.hikari.HikariDataSource db)
{})]
(is (instance? java.sql.Connection con))))
(testing "connection via c3p0"
(with-open [con (p/get-connection (c/jdbc-url com.mchange.v2.c3p0.ComboPooledDataSource db)
(with-open [con (p/get-connection (c/->pool com.mchange.v2.c3p0.ComboPooledDataSource db)
{})]
(is (instance? java.sql.Connection con))))))