Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2025-02-20 21:34:50 -08:00
parent f7dbfba57c
commit 03d96f5747
No known key found for this signature in database
2 changed files with 17 additions and 0 deletions

View file

@ -1,6 +1,7 @@
# Changes # Changes
* 2.6.next in progress * 2.6.next in progress
* Address [#568](https://github.com/seancorfield/honeysql/issues/568) by adding `honey.sql/semicolon` to merge multiple SQL+params vectors into one (with semicolons separating the SQL statements).
* Address [#567](https://github.com/seancorfield/honeysql/issues/567) by adding support for `ASSERT` clause. * Address [#567](https://github.com/seancorfield/honeysql/issues/567) by adding support for `ASSERT` clause.
* Address [#566](https://github.com/seancorfield/honeysql/issues/566) by adding `IS [NOT] DISTINCT FROM` operators. * Address [#566](https://github.com/seancorfield/honeysql/issues/566) by adding `IS [NOT] DISTINCT FROM` operators.
* Add examples of `:alias` with `:group-by` (syntax is slightly different to existing examples for `:order-by`). * Add examples of `:alias` with `:group-by` (syntax is slightly different to existing examples for `:order-by`).

View file

@ -2517,6 +2517,22 @@
(first clauses) (first clauses)
(into [:and] clauses)))) (into [:and] clauses))))
(defn semicolon
"Given either a vector of formatted SQL+params vectors, or two or more
SQL+params vectors as arguments, merge them into a single SQL+params
vector with the SQL strings separated by semicolons."
([sql+params-vector]
(reduce into
[(str/join "; " (map first sql+params-vector))]
(map rest sql+params-vector)))
([sql+params & more]
(semicolon (cons sql+params more))))
(comment
(semicolon [ ["foo" 1 2 3] ["bar" 4 5 6] ])
(semicolon ["foo" 1 2 3] ["bar" 4 5 6] ["baz" 7 8 9] )
)
;; aids to migration from HoneySQL 1.x -- these are deliberately undocumented ;; aids to migration from HoneySQL 1.x -- these are deliberately undocumented
;; so as not to encourage their use for folks starting fresh with 2.x! ;; so as not to encourage their use for folks starting fresh with 2.x!