Skip to content

Instantly share code, notes, and snippets.

@kennyjwilli
Created March 3, 2022 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennyjwilli/b46a244aaba4c9248dfe733413fd2e40 to your computer and use it in GitHub Desktop.
Save kennyjwilli/b46a244aaba4c9248dfe733413fd2e40 to your computer and use it in GitHub Desktop.
(defn ->eql
[?schema]
(let [f (fn convert [paths]
(let [k->joins (reduce (fn [acc [k & joins]]
(update acc k (fnil #(cond-> % joins (conj joins)) [])))
{} paths)]
(into []
(map (fn [[k joins]]
(if (seq joins) {k (convert joins)} k)))
k->joins)))]
(f (keep (fn [{:keys [in]}]
(when (seq in) (remove #{::m/in} in))) (mu/subschemas ?schema)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment