fix #480 by adding notes about DSL clause to/from helper mapping

This commit is contained in:
Sean Corfield 2023-03-23 19:29:09 -07:00
parent 7e67caaf0c
commit f5744d4f21
4 changed files with 14 additions and 0 deletions

View file

@ -2,6 +2,7 @@
* 2.4.next in progress
* Address [#481](https://github.com/seancorfield/honeysql/issues/481) by adding more examples around `:do-update-set`.
* Address [#480](https://github.com/seancorfield/honeysql/issues/480) by clarifying the general relationship between clauses and helpers.
* 2.4.1006 -- 2023-03-17
* Fix [#478](https://github.com/seancorfield/honeysql/issues/478) by handling `:do-update-set` correctly in the `upsert` helper and by handling parameters correctly in the `:do-update-set` formatter.

View file

@ -157,6 +157,10 @@ function in the `honey.sql.helpers` namespace:
=> {:select [:a :b :c] :from [:foo] :where [:= :foo.a "baz"]}
```
In general, `(helper :foo expr)` will produce `{:helper [:foo expr]}`
(with a few exceptions -- see the docstring of the helper function
for details).
Order doesn't matter (for independent clauses):
```clojure

View file

@ -22,6 +22,11 @@ The examples herein assume:
where order-by over partition-by window]])
```
Every DDL and SQL clause has a corresponding helper function
in `honey.sql.helpers`. In general, `(helper :foo expr)` will
produce `{:helper [:foo expr]}` (with a few exceptions -- see
the docstring of the helper function for details).
# DDL Clauses
HoneySQL supports the following DDL clauses as a data DSL.

View file

@ -277,6 +277,10 @@ supports out of the box. In addition, there are helpers for
parts of the SQL DSL (examples of `composite` appear in the [README](/README.md),
examples of `over` appear in the [Clause Reference](clause-reference.md))
In general, `(helper :foo expr)` will produce `{:helper [:foo expr]}`
(with a few exceptions -- see the docstring of the helper function
for details).
In addition to being variadic -- which often lets you omit one
level of `[`..`]` -- the helper functions merge clauses, which
can make it easier to build queries programmatically: