add erase from #532

Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2024-11-22 23:14:02 -08:00
parent ee53c54255
commit 129239a742
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View file

@ -60,7 +60,7 @@
:select :select-distinct :select-distinct-on :select-top :select-distinct-top
:distinct :expr :exclude :rename
:into :bulk-collect-into
:insert-into :replace-into :update :delete :delete-from :truncate
:insert-into :replace-into :update :delete :delete-from :erase-from :truncate
:columns :set :from :using
:join-by
:join :left-join :right-join :inner-join :outer-join :full-join
@ -1638,6 +1638,7 @@
:update (check-where #'format-selector)
:delete (check-where #'format-selects)
:delete-from (check-where #'format-selector)
:erase-from (check-where #'format-selector)
:truncate #'format-truncate
:columns #'format-columns
:set #'format-set-exprs

View file

@ -62,3 +62,9 @@
(deftest dotted-array-access-tests
(is (= ["SELECT (a.b).c"]
(sql/format '{select (((. (nest :a.b) :c)))}))))
(deftest erase-from-test
(is (= ["ERASE FROM foo WHERE foo.id = ?" 42]
(-> {:erase-from :foo
:where [:= :foo.id 42]}
(sql/format)))))