YeSQL does not handle joins or a pool of joins. You need to process it from the outside and provide a connection instance for the request function.
As you can see from the YeSQL example from README :
; Define a database connection spec. (This is standard clojure.java.jdbc.) (def db-spec {:classname "org.postgresql.Driver" :subprotocol "postgresql" :subname "//localhost:5432/demo" :user "me"}) ; Use it standalone. Note that the first argument is the db-spec. (users-by-country db-spec "GB") ;=> ({:count 58}) ; Use it in a clojure.java.jdbc transaction. (require '[clojure.java.jdbc :as jdbc]) (jdbc/with-db-transaction [connection db-spec] {:limeys (users-by-country connection "GB") :yanks (users-by-country connection "US")})
If you ask how to add connection pool processing, you can check out the example from the Clojure Cookbook .
Regarding transaction processing, the YeSQL documentation is not, but the source is pretty easy to understand:
(defn- emit-query-fn "Emit function to run a query. - If the query name ends in `!` it will call `clojure.java.jdbc/execute!`, - If the query name ends in `<!` it will call `clojure.java.jdbc/insert!`, - otherwise `clojure.java.jdbc/query` will be used." [{:keys [name docstring statement]}] (let [split-query (split-at-parameters statement) {:keys [query-args display-args function-args]} (split-query->args split-query) jdbc-fn (cond (= [\< \!] (take-last 2 name)) `insert-handler (= \! (last name)) `execute-handler :else `jdbc/query)] `(def ~(fn-symbol (symbol name) docstring statement display-args) (fn [db
That way, it will simply generate a function that either calls clojure.java.jdbc/execute! , or clojure.java.jdbc/insert! generated request. You may need to refer to the documentation for these functions for more details.
source share