seancorfield / next-jdbc

A modern low-level Clojure wrapper for JDBC-based access to databases.
https://cljdoc.org/d/com.github.seancorfield/next.jdbc/
Eclipse Public License 1.0
768 stars 90 forks source link

Default options support #122

Closed seancorfield closed 4 years ago

seancorfield commented 4 years ago

Extracted from the middleware concept, this will just be a new type of connectable (and transactable?) that will wrap an existing connectable (transactable) in a record type that also includes default options.

It will be implemented for plan, execute-one!, execute! (via their protocol implementations in next.jdbc.result-set) and for transact (via its protocol implementation in next.jdbc.transaction).

next.jdbc.default-options will contain the record type (and will be ^:no-doc like next.jdbc.transaction). next.jdbc will get a new with-options function that just invokes the constructor. next.jdbc.result-set and next.jdbc.transaction will provide implementations of the executable and transactable protocols that simply invoke the protocols on the wrapped connectable with the merged options.