This commit is contained in:
Sean Corfield 2023-06-10 19:12:15 -07:00
parent e7737ee7af
commit 445f66ae1e
2 changed files with 13 additions and 0 deletions

View file

@ -1,5 +1,8 @@
# Changes
* 2.4.next in progress
* Address [#489](https://github.com/seancorfield/honeysql/issues/489) by adding more examples around `:update`.
* 2.4.1033 -- 2023-05-22
* Tentative [ClojureCLR](https://github.com/clojure/clojure-clr) support.
* Improve `on-conflict` helper docstring [#490](https://github.com/seancorfield/honeysql/pull/490) [@holyjak](https://github.com/holyjak).

View file

@ -621,6 +621,16 @@ user=> (sql/format {:update :transport
["UPDATE transport SET name = ? WHERE id = ?" "Yacht" 2]
```
You can also set columns to `NULL` or to their default values:
```clojure
user=> (sql/format {:update :transport
:set {:owner nil, :date_built [:default]}
:where [:= :id 2]})
["UPDATE transport SET owner = NULL, date_built = DEFAULT WHERE id = ?"
2]
```
## delete, delete-from
`:delete-from` is the simple use case here, accepting just a