I have a DB namespace for each DB table, and each namespace includes functions called CREATE, READ, UPDATE, and DELETE. I am defining routes that correspond to these functions and want to be able to iterate through then namespaces and contruct the full function reference. I am able to create a symbol that LOOKS like the function reference, but it isn’t the real function and fails in practice. How can this be done (and does it need to be done with a macro)? Here’s what I have tried:
(defn crud-routes
""
[]
(into []
(for [ns ["agroups" "attachments" "categories" "categorylinks" "clients" "computers" "core" "departments" "devices" "flaglinks" "flags" "grouplinks" "histories" "jobs" "knowledgebases" "logs" "memo" "memos" "migratus" "permissionlinks" "permissions" "pictures" "queries" "searches" "stats" "techs" "users" "works"]]
[(str "/" ns) {:get #(response/ok "got me";((eval (symbol (str ns "/READ"))))
)
:post (symbol (str ns "/CREATE"))
:patch (symbol (str ns "/UPDATE"))
:delete (symbol (str ns "/DELETE"))}])))