Restore cljs compatibility

This commit is contained in:
Sean Corfield 2021-01-30 17:27:00 -08:00
parent 830301c843
commit 07eb66759a
3 changed files with 8 additions and 4 deletions

View file

@ -344,7 +344,7 @@ to identify inline parameter values, and how to add in raw SQL fragments!
``` ```
```clojure ```clojure
call-qualify-map call-qualify-map
=> {:where [:and [:= :a [:param :baz]] [:= :b [:inline 42]]] => '{:where [:and [:= :a [:param :baz]] [:= :b [:inline 42]]]
:from (:foo) :from (:foo)
:select [[[:foo :bar]] [[:raw "@var := foo.bar"]]]} :select [[[:foo :bar]] [[:raw "@var := foo.bar"]]]}
``` ```

View file

@ -460,10 +460,11 @@
"in" "not-in" "like" "not-like" "regexp" "in" "not-in" "like" "not-like" "regexp"
"ilike" "not-ilike" "similar-to" "not-similar-to" "ilike" "not-ilike" "similar-to" "not-similar-to"
"is" "is-not" "not=" "!=" "regex"} "is" "is-not" "not=" "!=" "regex"}
(into (map str "+-*/%|&^=<>")) (into (map str "+-*%|&^=<>"))
(into (keys infix-aliases)) (into (keys infix-aliases))
(into (vals infix-aliases)) (into (vals infix-aliases))
(->> (into #{} (map keyword))) (->> (into #{} (map keyword)))
(conj :/) ; because (keyword "/") does not work in cljs
(atom))) (atom)))
(def ^:private op-ignore-nil (atom #{:and :or})) (def ^:private op-ignore-nil (atom #{:and :or}))

View file

@ -5,7 +5,10 @@
(:require #?(:clj [clojure.test :refer [deftest is testing]] (:require #?(:clj [clojure.test :refer [deftest is testing]]
:cljs [cljs.test :refer-macros [deftest is testing]]) :cljs [cljs.test :refer-macros [deftest is testing]])
[honey.sql :as sql] [honey.sql :as sql]
[honey.sql.helpers :refer :all])) [honey.sql.helpers
:refer [columns cross-join from full-join group-by having insert-into
join left-join limit offset order-by right-join
select select-distinct values where with]]))
(deftest test-select (deftest test-select
(let [m1 (-> (with [:cte (-> (select :*) (let [m1 (-> (with [:cte (-> (select :*)
@ -263,7 +266,7 @@
:from [:collection] :from [:collection]
:where [:= :personal_owner_id nil]} :where [:= :personal_owner_id nil]}
(clojure.core/for [id ids] (clojure.core/for [id ids]
[:not-like :location [:raw (clojure.core/format "'/%d/%%'" id)]]))))) [:not-like :location [:raw (str "'/" id "/%'")]])))))
(deftest issue-282 (deftest issue-282
(is (= [(str "SELECT id AS id FROM collection" (is (= [(str "SELECT id AS id FROM collection"