如何从返回的地图中获取生成的密钥。它似乎以“()”结尾,我似乎无法像常规键一样使用它。
(defn create-map-db [mapname]
(insert! db-settings :MAP_TABLE {:M_NAME mapname})
)
(first (create-map-db "Moskau"))
=> {:scope_identity() 3}
(type (first (create-map-db "Moskau")))
=> clojure.lang.PersistentArrayMap
(get (first (create-map-db "Moskau")) :scope_identity())
=> ()
(get (first (create-map-db "Moskau")) :scope_identity)
=> nil
答案 0 :(得分:3)
我可以看到类似以下内容的最便携式解决方案:
(first (vals (first (create-map-db "Moskau"))))
但如果您真的想要,可以直接使用以下方式访问密钥:
(def generated-key (keyword "scope_identity()"))
(generated-key (first (create-map-db "Moskau")))
这也可用于所有生成的密钥:
(map generated-key (create-map-db "Moskau"))