Skip to content

Instantly share code, notes, and snippets.

@pingles
Created April 18, 2011 19:48
Show Gist options
  • Save pingles/926030 to your computer and use it in GitHub Desktop.
Save pingles/926030 to your computer and use it in GitHub Desktop.
(defprotocol ToClojure
(to-clojure [x] "Convert hector types to Clojure data structures"))
(extend-protocol ToClojure
RowsImpl
(to-clojure [s]
(map to-clojure (iterator-seq (.iterator s))))
RowImpl
(to-clojure [s]
{:key (.getKey s)
:columns (to-clojure (.getColumnSlice s))})
QueryResultImpl
(to-clojure [s]
(with-meta (to-clojure (.get s)) {:exec_us (.getExecutionTimeMicro s)
:host (.getHostUsed s)})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment