这行得通,但我很好奇动态传递命名空间并使用 ns-resolve 解析它的性能损失是什么......
(ns bulbs.vertices)
(defn create
[config data]
((ns-resolve (:ns config) 'create-vertex) config data))
然后这样称呼它...
(ns bulbs.neo4jserver.graph
(:require [bulbs.vertices :as vertices])
(:require [bulbs.neo4jserver.client :as client]))
(defn graph
[& [config]]
(let [config (client/build-config config {:ns 'bulbs.neo4jserver.client})]
(fn [func & args]
(apply func config args))))
(def g (graph))
(g vertices/create {:name "James"})