-
-
Save jtmarmon/08d66a8a0f95f0510b92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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