Skip to content
Snippets Groups Projects
Commit 753d4bec authored by Cam Saul's avatar Cam Saul
Browse files

better forced lazy loading for test data

parent f1d626e3
No related branches found
No related tags found
No related merge requests found
......@@ -164,12 +164,12 @@
:private true}
tables
(delay
@test-db ; force lazy evaluation of Test DB
(binding [*log-db-calls* false]
(letfn [(table-kw->table-id [table-kw]
(->> (-> table-kw name .toUpperCase)
(sel :one [Table :id] :db_id @db-id :name)
:id))]
(map-table-kws table-kw->table-id)))))
(map-table-kws (fn [table-kw]
(->> (-> table-kw name .toUpperCase)
(sel :one [Table :id] :db_id @db-id :name)
:id))))))
(def
^{:doc "A map of Table name keywords -> map of Field name keywords -> Field IDs.
......@@ -180,16 +180,16 @@
:private true}
table-fields
(delay
@test-db ; force lazy evaluation of Test DB
(binding [*log-db-calls* false]
(letfn [(table-kw->fields [table-kw]
(->> (sel :many [Field :name :id] :table_id (@tables table-kw))
(map (fn [{:keys [^String name id]}]
{:pre [(string? name)
(integer? id)
(not (zero? id))]}
{(keyword (.toLowerCase name)) id}))
(reduce merge {})))]
(map-table-kws table-kw->fields)))))
(map-table-kws (fn [table-kw]
(->> (sel :many [Field :name :id] :table_id (@tables table-kw))
(map (fn [{:keys [^String name id]}]
{:pre [(string? name)
(integer? id)
(not (zero? id))]}
{(keyword (.toLowerCase name)) id}))
(reduce merge {})))))))
;; ## Users
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment