fix #454 by allowing - to be variadic

This commit is contained in:
Sean Corfield 2023-01-14 15:35:03 -08:00
parent 6bdc262e7c
commit 4a7c3631a6
3 changed files with 14 additions and 1 deletions

View file

@ -1,6 +1,7 @@
# Changes
* 2.4.next in progress
* Fix [#454](https://github.com/seancorfield/honeysql/issues/454) by allowing `-` to be variadic.
* Address [#452](https://github.com/seancorfield/honeysql/pull/452) by adding `:replace-into` to the core SQL supported, instead of just for the MySQL and SQLite dialects (so the latter is not needed yet).
* Address [#451](https://github.com/seancorfield/honeysql/issues/451) by adding a test for it, showing how `:nest` produces the desired result.
* Address [#447](https://github.com/seancorfield/honeysql/issues/447) by updating GitHub Actions and dependencies.

View file

@ -1279,7 +1279,7 @@
(atom)))
(def ^:private op-ignore-nil (atom #{:and :or}))
(def ^:private op-variadic (atom #{:and :or :+ :* :|| :&&}))
(def ^:private op-variadic (atom #{:and :or :+ :* :- :|| :&&}))
(defn- unwrap [x opts]
(if-let [m (meta x)]

12
test/honey/ops_test.cljc Normal file
View file

@ -0,0 +1,12 @@
;; copyright (c) 2023 sean corfield, all rights reserved
(ns honey.ops-test
(:refer-clojure :exclude [format])
(:require [clojure.test :refer [deftest is]]
[honey.sql :as sut]
[honey.sql :as sql]))
(deftest issue-454
(is (= ["SELECT a - b - c AS x"]
(-> {:select [[[:- :a :b :c] :x]]}
(sql/format)))))