proposed syntax for #281
This commit is contained in:
parent
8976379fa6
commit
499b9de0ae
1 changed files with 16 additions and 0 deletions
16
test/honey/bigquery_test.cljc
Normal file
16
test/honey/bigquery_test.cljc
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
;; copyright (c) 2022 sean corfield, all rights reserved
|
||||||
|
|
||||||
|
(ns honey.bigquery-test
|
||||||
|
(:refer-clojure :exclude [format])
|
||||||
|
(:require [clojure.test :refer [deftest is]]
|
||||||
|
[honey.sql :as sut]))
|
||||||
|
|
||||||
|
(deftest except-replace-tests
|
||||||
|
(is (= ["SELECT * FROM table WHERE id = ?" 1]
|
||||||
|
(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 * 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]
|
||||||
|
(sut/format {:select [[:* :except [:a :b] :replace [[[:inline 2] :c]]]] :from [:table] :where [:= :id 1]}))))
|
||||||
Loading…
Reference in a new issue