…but let's say I have this result (from an arbitrary query).
| user.id | user.name | post.id | post.title |
+---------+-----------+---------+------------+
| 1 | renke1 | 1 | first |
| 2 | alde | 2 | second |
| 2 | alde | 3 | third |
Now I would like to tell the library: hey, an user can have many posts (1:n), please map this to nested objects.Of course I don't want to write `SELECT user.id, user.name … FROM …` but just `SELECT * FROM …` (because a table may have a dozen of columns and I don't want to spell out every single one). So the query might have to be rewritten on-the-fly to make the correct projection (otherwise it would be hard to know to which object a value belongs).
I am not sure if that's something your library should do though.
And thinking even more about it, I think this approach wouldn't really work for views (and probably other things) where it's not really clear from which tables the data actually comes from (at least not by only looking at the query).
I guess what I really want is library that takes my SQL query, reads my mind and gives me back some nested objects… and let's not talk about inserts…