Solve an issue where namespaced keywords and symbols where only taking the name portion of the identifier.
- This now checks if there is a namespace and prepends it to the name if it exists.
This commit is contained in:
parent
634cad74cb
commit
5b197f9756
3 changed files with 10 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
## 0.7.1 In development
|
||||
|
||||
* Allow namespaced keywords and symbols for queries. (@jrdoane)
|
||||
|
||||
## 0.7.0
|
||||
|
||||
* Parameterize numbers, properly handle NaN, Infinity, -Infinity (@akhudek)
|
||||
|
|
|
|||
|
|
@ -62,7 +62,10 @@
|
|||
(quote-fns style)
|
||||
*quote-identifier-fn*)
|
||||
s (cond
|
||||
(or (keyword? x) (symbol? x)) (name-transform-fn (name x))
|
||||
(or (keyword? x) (symbol? x))
|
||||
(name-transform-fn
|
||||
(str (when-let [n (namespace x)]
|
||||
(str n "/")) (name x)))
|
||||
(string? x) (if qf x (name-transform-fn x))
|
||||
:else (str x))]
|
||||
(if-not qf
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@
|
|||
(is (= (quote-identifier :foo-bar.moo-bar :style :ansi)
|
||||
"\"foo-bar\".\"moo-bar\""))))
|
||||
|
||||
(deftest test-namespaced-identifier
|
||||
(is (= (quote-identifier :foo/bar) "foo/bar"))
|
||||
(is (= (quote-identifier :foo/bar :style :ansi) "\"foo/bar\"")))
|
||||
|
||||
(deftest test-cte
|
||||
(is (= (format-clause
|
||||
(first {:with [[:query {:select [:foo] :from [:bar]}]]}) nil)
|
||||
|
|
|
|||
Loading…
Reference in a new issue