Fork me on GitHub

Are there any helper functions for reshaping a SELECT + JOIN query to nest the joined columns under a key at the root? For example, given a Pet with a single Owner, we have a select on Pet select * from pet inner join owner on = pet.owner_id, and I'd like to reshape the flat map returned by the query into a map such as { :pet/id 1 :pet/owner { :owner/id 1 :owner/name "Alice" } } I know this isn't next.jdbc's core area, but with all the other little helpers I thought there might be such a fn.


@ramblurr Such a thing would always be very domain-specific although I think a few people have written functions to coalesce result sets based on keys/namespaces -- but 1:1 and 1:many look pretty different and you can't deduce that from the shape of the data in general so those relationships have to be "hinted" somehow through parameters.


fair enough!


The request comes up from time to time and I've given it some thought. I'll open an issue to track it because I think I might have enough examples in mind now to figure out something that would probably cover most cases (covering 100% is likely to be hard).