accept explicit parameters in quote-identifiers
This commit is contained in:
parent
35fbbabffa
commit
cff7abad1f
2 changed files with 11 additions and 5 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
(defalias param types/param)
|
(defalias param types/param)
|
||||||
(defalias format format/format)
|
(defalias format format/format)
|
||||||
(defalias format-predicate format/format-predicate)
|
(defalias format-predicate format/format-predicate)
|
||||||
|
(defalias quote-identifier format/quote-identifier)
|
||||||
|
|
||||||
(defn qualify
|
(defn qualify
|
||||||
"Takes one or more keyword or string qualifers and name. Returns
|
"Takes one or more keyword or string qualifers and name. Returns
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,16 @@
|
||||||
|
|
||||||
(def ^:dynamic *quote-identifier-fn* nil)
|
(def ^:dynamic *quote-identifier-fn* nil)
|
||||||
|
|
||||||
(defn quote-identifier [x]
|
(defn quote-identifier [x & {:keys [style split] :or {split true}}]
|
||||||
(if-not *quote-identifier-fn*
|
(let [qf (if style
|
||||||
x
|
(quote-fns style)
|
||||||
(let [parts (string/split (name x) #"\.")]
|
*quote-identifier-fn*)]
|
||||||
(string/join "." (map #(*quote-identifier-fn* %) parts)))))
|
(if-not qf
|
||||||
|
x
|
||||||
|
(if-not split
|
||||||
|
(qf (name x))
|
||||||
|
(let [parts (string/split (name x) #"\.")]
|
||||||
|
(string/join "." (map qf parts)))))))
|
||||||
|
|
||||||
(def infix-fns
|
(def infix-fns
|
||||||
#{"+" "-" "*" "/" "%" "mod" "|" "&" "^"
|
#{"+" "-" "*" "/" "%" "mod" "|" "&" "^"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue