address #474
This commit is contained in:
parent
5b4b709010
commit
da150f03e3
3 changed files with 15 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# Changes
|
||||
|
||||
* 2.4.next in progress
|
||||
* Address [#474](https://github.com/seancorfield/honeysql/issues/474) by adding dot-selection special syntax. Documentation TBD!
|
||||
* Improve docstrings for PostgreSQL operators via PR [#473](https://github.com/seancorfield/honeysql/pull/473) [@holyjak](https://github.com/holyjak).
|
||||
* Address [#471](https://github.com/seancorfield/honeysql/issues/471) by supported interspersed SQL keywords in function calls. Documentation TBD!
|
||||
* Fix [#467](https://github.com/seancorfield/honeysql/issues/467) by allowing single keywords (symbols) as a short hand for a single-element sequence in more constructs via PR [#470](https://github.com/seancorfield/honeysql/pull/470) [@p-himik](https://github.com/p-himik).
|
||||
|
|
|
|||
|
|
@ -1472,6 +1472,9 @@
|
|||
:primary-key #'function-0
|
||||
:references #'function-1
|
||||
:unique #'function-1-opt
|
||||
:. (fn [_ [expr col]]
|
||||
(let [[sql & params] (format-expr expr)]
|
||||
(into [(str sql "." (format-entity col))] params)))
|
||||
;; used in DDL to force rendering as a SQL entity instead
|
||||
;; of a SQL keyword:
|
||||
:entity (fn [_ [e]] [(format-entity e)])
|
||||
|
|
|
|||
|
|
@ -1130,3 +1130,14 @@ ORDER BY id = ? DESC
|
|||
(is (= ["SELECT XMLELEMENT(NAME \"foo$bar\", XMLATTRIBUTES('xyz' AS \"a&b\"))"]
|
||||
(sut/format {:select [[[:xmlelement :*name :foo$bar
|
||||
[:xmlattributes [:inline "xyz"] :*as :a&b]]]]})))))
|
||||
|
||||
(deftest issue-474-dot-selection
|
||||
(testing "basic dot selection"
|
||||
(is (= ["SELECT a.b, c.d, e.f"]
|
||||
(let [t :a c :d]
|
||||
(sut/format {:select [[[:. t :b]] [[:. :c c]] [[:. :e :f]]]})))))
|
||||
(testing "basic field selection from composite"
|
||||
(is (= ["SELECT (v).*, (w).x, (Y(z)).*"]
|
||||
(sut/format '{select (((. (nest v) *))
|
||||
((. (nest w) x))
|
||||
((. (nest (y z)) *)))})))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue