a simplification to prepare for #542
Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
dd9547bbc1
commit
150fcda6d3
1 changed files with 10 additions and 11 deletions
|
|
@ -822,10 +822,16 @@
|
||||||
(into [(str (format-entity (first x)) " " sql)] params))
|
(into [(str (format-entity (first x)) " " sql)] params))
|
||||||
[(format-entity x)]))
|
[(format-entity x)]))
|
||||||
|
|
||||||
(defn- format-with [k xs as-fn]
|
(defn- format-with [k xs]
|
||||||
;; TODO: a sequence of pairs -- X AS expr -- where X is either [entity expr]
|
;; TODO: a sequence of pairs -- X AS expr -- where X is either [entity expr]
|
||||||
;; or just entity, as far as I can tell...
|
;; or just entity, as far as I can tell...
|
||||||
(let [[sqls params]
|
(let [as-fn
|
||||||
|
(fn [[_ _ materialization]]
|
||||||
|
(condp = materialization
|
||||||
|
:materialized "AS MATERIALIZED"
|
||||||
|
:not-materialized "AS NOT MATERIALIZED"
|
||||||
|
"AS"))
|
||||||
|
[sqls params]
|
||||||
(reduce-sql
|
(reduce-sql
|
||||||
(map
|
(map
|
||||||
(fn [[x expr :as with]]
|
(fn [[x expr :as with]]
|
||||||
|
|
@ -1487,15 +1493,8 @@
|
||||||
:nest (fn [_ x]
|
:nest (fn [_ x]
|
||||||
(let [[sql & params] (format-dsl x {:nested true})]
|
(let [[sql & params] (format-dsl x {:nested true})]
|
||||||
(into [sql] params)))
|
(into [sql] params)))
|
||||||
:with (let [as-fn
|
:with #'format-with
|
||||||
(fn [[_ _ materialization]]
|
:with-recursive #'format-with
|
||||||
(condp = materialization
|
|
||||||
:materialized "AS MATERIALIZED"
|
|
||||||
:not-materialized "AS NOT MATERIALIZED"
|
|
||||||
"AS"))]
|
|
||||||
(fn [k xs] (format-with k xs as-fn)))
|
|
||||||
:with-recursive (let [as-fn (constantly "AS")]
|
|
||||||
(fn [k xs] (format-with k xs as-fn)))
|
|
||||||
:intersect #'format-on-set-op
|
:intersect #'format-on-set-op
|
||||||
:union #'format-on-set-op
|
:union #'format-on-set-op
|
||||||
:union-all #'format-on-set-op
|
:union-all #'format-on-set-op
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue