mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 18:48:37 -05:00
🎉 Add insert-multi helper on db namespace.
This commit is contained in:
parent
8ad8196d70
commit
77c2a98304
2 changed files with 12 additions and 0 deletions
|
@ -200,6 +200,13 @@
|
||||||
(sql/insert table params opts)
|
(sql/insert table params opts)
|
||||||
(assoc opts :return-keys true))))
|
(assoc opts :return-keys true))))
|
||||||
|
|
||||||
|
(defn insert-multi!
|
||||||
|
([ds table cols rows] (insert-multi! ds table cols rows nil))
|
||||||
|
([ds table cols rows opts]
|
||||||
|
(exec! ds
|
||||||
|
(sql/insert-multi table cols rows opts)
|
||||||
|
(assoc opts :return-keys true))))
|
||||||
|
|
||||||
(defn update!
|
(defn update!
|
||||||
([ds table params where] (update! ds table params where nil))
|
([ds table params where] (update! ds table params where nil))
|
||||||
([ds table params where opts]
|
([ds table params where opts]
|
||||||
|
|
|
@ -32,6 +32,11 @@
|
||||||
(assoc :suffix "ON CONFLICT DO NOTHING"))]
|
(assoc :suffix "ON CONFLICT DO NOTHING"))]
|
||||||
(sql/for-insert table key-map opts))))
|
(sql/for-insert table key-map opts))))
|
||||||
|
|
||||||
|
(defn insert-multi
|
||||||
|
[table cols rows opts]
|
||||||
|
(let [opts (merge default-opts opts)]
|
||||||
|
(sql/for-insert-multi table cols rows opts)))
|
||||||
|
|
||||||
(defn select
|
(defn select
|
||||||
([table where-params]
|
([table where-params]
|
||||||
(select table where-params nil))
|
(select table where-params nil))
|
||||||
|
|
Loading…
Add table
Reference in a new issue