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
* 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 `@`).
* 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).

View file

@ -250,9 +250,9 @@ user=> (sql/format {:delete-from :distributors
user=> (-> (update :distributors)
(set {:dname "Foo Bar Designs"})
(where [:= :did 2])
(returning [:did :dname])
(returning :did :dname)
sql/format)
["UPDATE distributors SET dname = ? WHERE did = ? RETURNING did dname"
["UPDATE distributors SET dname = ? WHERE did = ? RETURNING did, dname"
"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
"Helper functions for the built-in clauses in honey.sql.
@ -870,9 +870,9 @@
"Accepts any number of column names to return from an
insert operation:
(returning :*)
(returning :*) and (returning :a :b)
Produces: RETURNING *"
Produce: RETURNING * and RETURNING a, b respectively."
[& cols]
(generic :returning cols))

View file

@ -152,11 +152,11 @@
(sql/format {:delete-from :distributors
:where [:> :did :10]
: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)
(set {:dname "Foo Bar Designs"})
(where [:= :did :2])
(returning [:did :dname])
(returning :did :dname)
sql/format)))))
(deftest create-view-test