~subsetpark/doozer

doozer/doozer.janet -rw-r--r-- 576 bytes
4a8e0e3e — Zach Smith update docs 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(import /doozer/from :export true :prefix "")
(import /doozer/to-sql :export true :prefix "")

(defn get-sources
  ```
  Produce a struct mapping all named sources to the tables they refer to.

  This can be used, especially in interactive development, to determine if
  there's an existing JOIN in `query` that can be reused in subsequent calls to
  the `where` macro.
  ```
  [query]
  (let [res @{(query :as) (query :from)}]
    (each join (query :join)
      (put res (join :as) (join :table)))
    res))

(defn get-config
  []
  {:sql-backend (dyn :doozer/sql-backend)})