/
jdbc.clj
20 lines (17 loc) · 810 Bytes
/
jdbc.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(ns toucan2.jdbc
"The Toucan 2 `next.jdbc` query execution backend."
(:require
[toucan2.util :as u]))
(defonce ^{:doc "Default options automatically passed to all `next.jdbc` queries and builder functions. This is stored
as an atom; `reset!` or `swap!` it to define other default options."} global-options
(atom {:label-fn u/lower-case-en}))
(def ^:dynamic *options*
"Options to pass to `next.jdbc` when executing queries or statements. Overrides the [[global-options]]."
nil)
(defn merge-options
"Merge maps of `next.jdbc` options together. `extra-options` are ones passed in as part of the query execution pipeline
and override [[*options*]], which in turn override the default [[global-options]]."
[extra-options]
(merge @global-options
*options*
extra-options))