korma/Korma — pull request #142 by vgeshel (2013-04-08 22:38:51+00:00)
Title: Optimized fetching of has-many relations

This is similar to https://github.com/korma/Korma/pull/136. I did this without looking at open pull requests, sorry. The implementation is very similar but there are a couple of differences:

1. The eager fetch (I called it `with-batch`) does not replace the normal `with` behavior for has-many relations. The reason is that `with` allows subordinate `order`, `limit`, `offset`, `group`, and none of these will work correctly with `with-batch`. `with-batch` throws an exception if you try to use one of those things within it.

2. There is also a unit test that uses an in-memory database to exercise not just query-building logic but also the result-processing logic. If you set the enviornment variable BENCH to "true" it will also benchmark `with` and `with-batch`.