The first argument of a function generated by def-db-fns can take a database spec, a connection, a connection pool, or a transaction object. Use your underlying database library to get a transaction object. Here's an example with clojure.java.jdbc/with-db-transaction:
(clojure.java.jdbc/with-db-transaction [tx db]
(characters/insert-character tx
{:name "Miracle Max", :specialty "miracles"})
(characters/insert-character tx
{:name "Valerie", :specialty "speech interpreter"}))
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |