I'm submitting this as a pull request even though I could commit it directly because I want you to take a look and sign off first.
I added a transform method to RTable that lets you specify a transform function to be executed after deref. I also implmented pick using it based on the conversation we had in #clojureql. The transform function will also be really useful for other data transformations that have to be done in Clojure. i.e:
;; i just want a list of emails for all users
@(transform users #(map :email %))
;; several fields are json, and i need to parse them when records are loaded
@(transform records #(map parse-json %))
Transforms are also composable:
;; only parse and return the first record
@(-> records (transform #(map parse-json %)) (transform first))
I'm pretty excited about this feature as it is going to clean up a lot of our code and make ClojureQL even easier for our engineers to use.
Hey Lau,
I'm submitting this as a pull request even though I could commit it directly because I want you to take a look and sign off first.
I added a transform method to RTable that lets you specify a transform function to be executed after deref. I also implmented pick using it based on the conversation we had in #clojureql. The transform function will also be really useful for other data transformations that have to be done in Clojure. i.e:
Transforms are also composable:
I'm pretty excited about this feature as it is going to clean up a lot of our code and make ClojureQL even easier for our engineers to use.
Let me know if you have any questions.
Cheers, :justin