A wee bit of clean-up
This commit is contained in:
parent
8e92e9438d
commit
0be87038f0
|
@ -1,7 +1,7 @@
|
||||||
(ns squirrel-parse.core
|
(ns squirrel-parse.core
|
||||||
(:require [squirrel-parse.parser :refer [parse]]
|
(:require [squirrel-parse.parser :refer [parse]]
|
||||||
[squirrel-parse.simplify :refer [simplify]]
|
[squirrel-parse.simplify :refer [simplify]]
|
||||||
[squirrel-parse.to-adl :refer [to-adl]]))
|
[squirrel-parse.to-adl :refer [table-definitions-to-entities]]))
|
||||||
|
|
||||||
;;; This is get-you-started code.
|
;;; This is get-you-started code.
|
||||||
|
|
||||||
|
|
|
@ -224,15 +224,13 @@
|
||||||
fs-cols (:NAME (:NAMES (:REFERENCES-CC sm)))]
|
fs-cols (:NAME (:NAMES (:REFERENCES-CC sm)))]
|
||||||
(if
|
(if
|
||||||
(= table ns-table)
|
(= table ns-table)
|
||||||
(do
|
|
||||||
(println "...Firing!")
|
|
||||||
(deep-merge
|
(deep-merge
|
||||||
entity-map
|
entity-map
|
||||||
{:content
|
{:content
|
||||||
{:properties
|
{:properties
|
||||||
{(keyword ns-cols)
|
{(keyword ns-cols)
|
||||||
{:attrs
|
{:attrs
|
||||||
{:type "entity" :entity fs-table :farkey fs-cols}}}}}))
|
{:type "entity" :entity fs-table :farkey fs-cols}}}}})
|
||||||
;; else this statement doesn't refer to us...
|
;; else this statement doesn't refer to us...
|
||||||
))))
|
))))
|
||||||
|
|
||||||
|
@ -259,6 +257,9 @@
|
||||||
|
|
||||||
|
|
||||||
(defn decorate-with-all
|
(defn decorate-with-all
|
||||||
|
"Apply this `function` to this `entity-map` and each of these statements
|
||||||
|
in sequence, and return a merge of the map with each of the statements
|
||||||
|
which actually returned a value."
|
||||||
[entity-map statements function]
|
[entity-map statements function]
|
||||||
(reduce
|
(reduce
|
||||||
deep-merge
|
deep-merge
|
||||||
|
@ -279,7 +280,7 @@
|
||||||
(map
|
(map
|
||||||
(fn [x]
|
(fn [x]
|
||||||
(let [entity-map (base-map x)]
|
(let [entity-map (base-map x)]
|
||||||
{x
|
{(keyword x)
|
||||||
(decorate-with-all
|
(decorate-with-all
|
||||||
(decorate-with-all entity-map statements #(decorate-with-relationship %1 %2))
|
(decorate-with-all entity-map statements #(decorate-with-relationship %1 %2))
|
||||||
statements
|
statements
|
||||||
|
|
Loading…
Reference in a new issue