Updated to support "insert into ... select ..."
This commit is contained in:
parent
626d0a6bb9
commit
87b3837346
|
@ -1,4 +1,4 @@
|
|||
(defproject views "1.2.0"
|
||||
(defproject views "1.2.1"
|
||||
:description "A view to the past helps navigate the future."
|
||||
|
||||
:url "https://github.com/diligenceengine/views"
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
|
||||
(declare query-tables)
|
||||
|
||||
(defn- first-leaf
|
||||
"Retrieves the first leaf in a collection of collections
|
||||
|
||||
(first-leaf :table) -> :table
|
||||
(first-leaf [[:table] [& values]]) -> :table"
|
||||
[v]
|
||||
(if (coll? v) (recur (first v)) v))
|
||||
|
||||
(defn cte-tables
|
||||
[query]
|
||||
(mapcat #(query-tables (second %)) (:with query)))
|
||||
|
@ -45,7 +53,7 @@
|
|||
|
||||
(defn insert-tables
|
||||
[query]
|
||||
(if-let [v (:insert-into query)] [v] []))
|
||||
(some->> query :insert-into first-leaf vector))
|
||||
|
||||
(defn update-tables
|
||||
[query]
|
||||
|
|
Loading…
Reference in a new issue