Skip to content

Instantly share code, notes, and snippets.

@bcambel
Last active June 6, 2016 12:03
Show Gist options
  • Select an option

  • Save bcambel/7ad8827ad28aff322165d44219f52b81 to your computer and use it in GitHub Desktop.

Select an option

Save bcambel/7ad8827ad28aff322165d44219f52b81 to your computer and use it in GitHub Desktop.
(require '[clojure.string :as s])
(require '[cheshire.core :refer [parse-string])
(defn str->long [val] (Long/parseLong val))
(defn parse-date [val] val)
(defn extract-date-hour [val] val)
(def transformators {:url (comp (partial remove empty?) (fn[x] (when-not (empty? x)(s/split x #"/"))))
:data (fn[x] (if-not (nil? x)
(-> (parse-string x true) :data)))
:resp.data (fn[x] (if-not (nil? x)
(-> (parse-string x true) :data)))
:ip (fn[x] (when-not (nil? x) (first (s/split x #","))))
:date (comp extract-date-hour parse-date)
:response-start str->long
:response-end str->long})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment