given a map in clojure, {::my-func {:meta {...}, :fn #function[hugsql.core/db-fn*]}, automagically defined, how do I retrieve :fn value?
I've tried
(get-in map [:my-func :fn])
(get-in map [::my-func :fn])
(get-in map [:current-namespace/my-func :fn])
(get-in map [:namespaces-it-could-be/my-func :fn])
this is in context of hugsql/map-of-db-fns and hugsql/def-db-fns.
::xis a short-cut for writing a namespaced keyword for the current ns.So this is a convenience for the writer of the source or in the REPL, but does not actually get printed. Neither directly as seen above or inside maps
So it's to be expected that something went wrong here at some point and the printed
::my-funcis actually the keyword. Clojure does not allow such a keyword, but the function to create them happily accepts any nonsense.Rule of thumb: don't keywordize things, you don't have in your own hands. It's just as easy to use string keys for things others have defined for you. There is way more danger in invalid keywords, that change the meaning (like
:bro ken,::bork,:bork,bork), than to just use strings.