address #281 - support select foo.* except
This commit is contained in:
parent
a653f9b157
commit
e8e6c7f932
2 changed files with 3 additions and 1 deletions
|
|
@ -304,7 +304,7 @@
|
|||
(let [s (first x)
|
||||
a (second x)
|
||||
pair? (= 2 (count x))
|
||||
big? (and (ident? s) (= "*" (name s))
|
||||
big? (and (ident? s) (or (= "*" (name s)) (str/ends-with? (name s) ".*"))
|
||||
(ident? a) (#{"except" "replace"} (name a)))
|
||||
more? (and (< 2 (count x)) (not big?))
|
||||
[sql & params] (if (map? s)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
(sut/format {:select [:*] :from [:table] :where [:= :id 1]})))
|
||||
(is (= ["SELECT * EXCEPT (a, b, c) FROM table WHERE id = ?" 1]
|
||||
(sut/format {:select [[:* :except [:a :b :c]]] :from [:table] :where [:= :id 1]})))
|
||||
(is (= ["SELECT table.* EXCEPT (a, b, c) FROM table WHERE id = ?" 1]
|
||||
(sut/format {:select [[:table.* :except [:a :b :c]]] :from [:table] :where [:= :id 1]})))
|
||||
(is (= ["SELECT * REPLACE (a * 100 AS b, 2 AS c) FROM table WHERE id = ?" 1]
|
||||
(sut/format {:select [[:* :replace [[[:* :a [:inline 100]] :b] [[:inline 2] :c]]]] :from [:table] :where [:= :id 1]})))
|
||||
(is (= ["SELECT * EXCEPT (a, b) REPLACE (2 AS c) FROM table WHERE id = ?" 1]
|
||||
|
|
|
|||
Loading…
Reference in a new issue