Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Right, but fetching rows along with a bunch of related rows from other tables isn't niche, it's literally the _raison d'etre_ of GraphQL (simplifying a bit because GraphQL types don't necessarily map onto db tables.)

It's something lots of apps need all the time.



Static-language clients need to create a class (or collection of classes) for each GraphQL query, or forgo type safety (typically just null-safety, but I suppose you could treat each result as a dictionary type). Creating just the schema-level types, with relationships modeled separately, does throw out some of the benefits ("just the data you need") but simplifies the client, moreso if the client may perform multiple complex queries on the same data.


You can do that in Postgres, either return nested json structures, or nested arrays.

For an example see: https://shusson.info/post/building-nested-json-objects-with-...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: