korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.47k stars 222 forks source link

let query execute composable #330

Closed gfZeng closed 8 years ago

gfZeng commented 8 years ago

Some times, we need make a query base an query. We use korma.core/select*, but it is not convenient enough. We can support nested query directly

(defn list-featureA-users []
  (select users ...))

(defn list-featureA-and-featureB-users []
  (select (list-featureA-users) ...))
immoh commented 8 years ago

Wow, this looks really cool. Two comments:

Is new macro really needed? All it is doing is wrapping the threading form in binding, this can be done in the function as well.

Also, can you add a test for this functionality so that we will catch regression in the future.

gfZeng commented 8 years ago

@immoh thanks for your mention.

I am already add tests and remove the unnecessary macro

immoh commented 8 years ago

Looks great, thanks!

immoh commented 8 years ago

Unfortunately I had to revert this as it caused unwanted side effects described in #341. Feel free to submit a new pull request if you can come up with another solution.