   [db v]
   v)
 
-;; Can't use deftx here as we need to return con* for the ::connection.
+;; Can't use deftx here as we need to return con* for the ::db.
 ;; If we would use deftx con would be returned.
 (defn tx-bind
   "Take a transacton `tx` containting a value `v` and a function `f` of

  [tx f]
  (Transaction. (fn [db]
                  (if-not (jdbc/db-is-rollback-only (db-repr/db-spec db))
                    (let [{db* ::connection v ::value} ((:op tx) db)
                          tx* (f v)]
                      (if-not (jdbc/db-is-rollback-only (db-repr/db-spec db*))
                        ((:op tx*) db*)
                        {::connection db* ::value nil}))
                    {::connection db ::value nil}))))

(deftx tx-rollback
  "Rollback the transaction. Further steps won't be executed."

(defmacro deftx
  "Define a function that creates a transaction. The first entry of the
  definitions argument vector will be bound to the database used during the
  execution of the transaction. Further arguments are optional. While
  the resulting functions have access to the object representing the database
  any modifications they make to it will be lost."
  {:arglists '([fn-name [db & args] & body]
               [fn-name doc-string [db & args] & body])}
  [fn-name & body]
