Skip to content

Instantly share code, notes, and snippets.

@jtmarmon
Last active August 29, 2015 14:21
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 jtmarmon/08d66a8a0f95f0510b92 to your computer and use it in GitHub Desktop.
Save jtmarmon/08d66a8a0f95f0510b92 to your computer and use it in GitHub Desktop.
;; Multimethod for transforming data based on the name of the source mongodb collection
(defmulti transform identity)
(defmethod transform "events" [data]
;; do something with data
)
(defmethod transform "users" [data]
;; do something with data
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defprotocol Collection-Transformer
(transform [mongo-db document]))
(def user-transformer
(reify Collection-Transformer
(transform [m d] "do stuff")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment