parent
084c1ec5e5
commit
230cc467a1
5 changed files with 17 additions and 4 deletions
|
|
@ -3,6 +3,7 @@
|
|||
* 2.6.next in progress
|
||||
* Fix [#543](https://github.com/seancorfield/honeysql/issues/543) by supporting both symbols and keywords in named parameters.
|
||||
* Getting Started updated based on feedback from Los Angeles Clojure meetup walkthrough [#539](https://github.com/seancorfield/honeysql/issues/539).
|
||||
* Fix [#538](https://github.com/seancorfield/honeysql/issues/538) by removing `mod` from list of infix operators.
|
||||
* Update Clojure version to 1.12.0.
|
||||
|
||||
* 2.6.1161 -- 2024-08-29
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ register formatters or behavior corresponding to clauses,
|
|||
operators, and functions.
|
||||
|
||||
Built in clauses include: `:select`, `:from`, `:where` and
|
||||
many more. Built in operators include: `:=`, `:+`, `:mod`.
|
||||
many more. Built in operators include: `:=`, `:+`, `:%`.
|
||||
Built in functions (special syntax) include: `:array`, `:case`,
|
||||
`:cast`, `:inline`, `:raw` and many more.
|
||||
|
||||
|
|
|
|||
|
|
@ -1622,7 +1622,7 @@
|
|||
:regex :regexp})
|
||||
|
||||
(def ^:private infix-ops
|
||||
(-> #{"mod" "and" "or" "xor" "<>" "<=" ">=" "||" "<->"
|
||||
(-> #{"and" "or" "xor" "<>" "<=" ">=" "||" "<->"
|
||||
"like" "not-like" "regexp" "~" "&&"
|
||||
"ilike" "not-ilike" "similar-to" "not-similar-to"
|
||||
"is" "is-not" "not=" "!=" "regex"
|
||||
|
|
|
|||
|
|
@ -336,7 +336,15 @@
|
|||
{:params {:ids values} :numbered true})))))))
|
||||
|
||||
(deftest test-case
|
||||
(is (= ["SELECT CASE WHEN foo < ? THEN ? WHEN (foo > ?) AND ((foo MOD ?) = ?) THEN foo / ? ELSE ? END FROM bar"
|
||||
(is (= ["SELECT CASE WHEN foo < ? THEN ? WHEN (foo > ?) AND ((foo % ?) = ?) THEN foo / ? ELSE ? END FROM bar"
|
||||
0 -1 0 2 0 2 0]
|
||||
(sql/format
|
||||
{:select [[[:case
|
||||
[:< :foo 0] -1
|
||||
[:and [:> :foo 0] [:= [:% :foo 2] 0]] [:/ :foo 2]
|
||||
:else 0]]]
|
||||
:from [:bar]})))
|
||||
(is (= ["SELECT CASE WHEN foo < ? THEN ? WHEN (foo > ?) AND (MOD(foo, ?) = ?) THEN foo / ? ELSE ? END FROM bar"
|
||||
0 -1 0 2 0 2 0]
|
||||
(sql/format
|
||||
{:select [[[:case
|
||||
|
|
|
|||
|
|
@ -356,7 +356,11 @@
|
|||
|
||||
(deftest compare-expressions-test
|
||||
(testing "Sequences should be fns when in value/comparison spots"
|
||||
(is (= ["SELECT foo FROM bar WHERE (col1 MOD ?) = (col2 + ?)" 4 4]
|
||||
(is (= ["SELECT foo FROM bar WHERE (col1 % ?) = (col2 + ?)" 4 4]
|
||||
(format {:select [:foo]
|
||||
:from [:bar]
|
||||
:where [:= [:% :col1 4] [:+ :col2 4]]})))
|
||||
(is (= ["SELECT foo FROM bar WHERE MOD(col1, ?) = (col2 + ?)" 4 4]
|
||||
(format {:select [:foo]
|
||||
:from [:bar]
|
||||
:where [:= [:mod :col1 4] [:+ :col2 4]]}))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue