fix #399 by correcting docs and tests

This commit is contained in:
Sean Corfield 2022-03-26 13:45:43 -07:00
parent c4efcc0cad
commit ab7c235329
4 changed files with 8 additions and 7 deletions

View file

@ -1,6 +1,7 @@
# Changes # Changes
* 2.2.next in progress * 2.2.next in progress
* Address [#399](https://github.com/seancorfield/honeysql/issues/399) by correcting multi-column `RETURNING` clauses in docs and tests.
* Address [#398](https://github.com/seancorfield/honeysql/issues/398) by adding `honey.sql.pg-json` namespace that registers PostgreSQL JSON operators and provides symbolic names for "unwritable" operators (that contain `@`). * Address [#398](https://github.com/seancorfield/honeysql/issues/398) by adding `honey.sql.pg-json` namespace that registers PostgreSQL JSON operators and provides symbolic names for "unwritable" operators (that contain `@`).
* Fix [#387](https://github.com/seancorfield/honeysql/issues/387) again. * Fix [#387](https://github.com/seancorfield/honeysql/issues/387) again.
* Update CI to reflect Clojure 1.11 release (master -> 1.11; new master is 1.12). * Update CI to reflect Clojure 1.11 release (master -> 1.11; new master is 1.12).

View file

@ -250,9 +250,9 @@ user=> (sql/format {:delete-from :distributors
user=> (-> (update :distributors) user=> (-> (update :distributors)
(set {:dname "Foo Bar Designs"}) (set {:dname "Foo Bar Designs"})
(where [:= :did 2]) (where [:= :did 2])
(returning [:did :dname]) (returning :did :dname)
sql/format) sql/format)
["UPDATE distributors SET dname = ? WHERE did = ? RETURNING did dname" ["UPDATE distributors SET dname = ? WHERE did = ? RETURNING did, dname"
"Foo Bar Designs" 2] "Foo Bar Designs" 2]
``` ```

View file

@ -1,4 +1,4 @@
;; copyright (c) 2020-2021 sean corfield, all rights reserved ;; copyright (c) 2020-2022 sean corfield, all rights reserved
(ns honey.sql.helpers (ns honey.sql.helpers
"Helper functions for the built-in clauses in honey.sql. "Helper functions for the built-in clauses in honey.sql.
@ -870,9 +870,9 @@
"Accepts any number of column names to return from an "Accepts any number of column names to return from an
insert operation: insert operation:
(returning :*) (returning :*) and (returning :a :b)
Produces: RETURNING *" Produce: RETURNING * and RETURNING a, b respectively."
[& cols] [& cols]
(generic :returning cols)) (generic :returning cols))

View file

@ -152,11 +152,11 @@
(sql/format {:delete-from :distributors (sql/format {:delete-from :distributors
:where [:> :did :10] :where [:> :did :10]
:returning [:*]}))) :returning [:*]})))
(is (= ["UPDATE distributors SET dname = ? WHERE did = 2 RETURNING did dname" "Foo Bar Designs"] (is (= ["UPDATE distributors SET dname = ? WHERE did = 2 RETURNING did, dname" "Foo Bar Designs"]
(-> (update :distributors) (-> (update :distributors)
(set {:dname "Foo Bar Designs"}) (set {:dname "Foo Bar Designs"})
(where [:= :did :2]) (where [:= :did :2])
(returning [:did :dname]) (returning :did :dname)
sql/format))))) sql/format)))))
(deftest create-view-test (deftest create-view-test