Merge pull request #132, allow namespaced keywords

This commit is contained in:
Michael Blume 2017-04-05 21:09:54 -07:00
commit e0072efbdc
3 changed files with 10 additions and 1 deletions

View file

@ -1,5 +1,7 @@
## 0.8.3 In development
* Allow namespaced keywords and symbols for queries. (@jrdoane)
## 0.8.2
* Don't parenthesize the subclauses of a UNION, UNION ALL, or INTERSECT clause. (@rnewman)

View file

@ -65,7 +65,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

View file

@ -32,6 +32,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)