Closed vinurs closed 1 year ago
here's one approach for inspecting the queries that HugSQL generates:
(defn log-sqlvec [sqlvec]
(log/info (->> sqlvec
(map #(clojure.string/replace (or % "") #"\n" ""))
(clojure.string/join " ; "))))
(defn log-command-fn [this db sqlvec options]
(log-sqlvec sqlvec)
(condp contains? (:command options)
#{:!} (hugsql.adapter/execute this db sqlvec options)
#{:? :<!} (hugsql.adapter/query this db sqlvec options)))
(defmethod hugsql.core/hugsql-command-fn :! [_sym] `log-command-fn)
(defmethod hugsql.core/hugsql-command-fn :<! [_sym] `log-command-fn)
(defmethod hugsql.core/hugsql-command-fn :? [_sym] `log-command-fn)
@yogthos wow, thanks for ur help 😄
hello, when i exec a fn like this
is there any way to log the final sql string it sends to db?