Skip to content

Instantly share code, notes, and snippets.

@billdozr
Created March 11, 2010 21:33
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 billdozr/329685 to your computer and use it in GitHub Desktop.
Save billdozr/329685 to your computer and use it in GitHub Desktop.
(defmacro map->entity
[m entype]
`(apply ~(symbol (str "make-" entype))
(interleave (keys ~m) (vals ~m))))
(defmethod db-fetch ::hash-map
[repository key]
(let [result (db-query key (:db repository))]
(map->entity (second result) (first result))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment