3 ms·
> It doesn't support map/tables/dictionaries. I don't understand this point. Is this talking about implementing GraphQL on the backend? Because consuming Grap
by kehrin 4y ago
> It doesn't support map/tables/dictionaries.
I don't understand this point. Is this talking about implementing GraphQL on the backend? Because consuming GraphQL you get a map, you get JSON! Do you mean a more specific data structures like a Set or Stack?
- nawgz 4y agoI think they were complaining that you couldn’t get back a query with unknown keys like a “select * from my_table” GQL equivalent
- drcode 4y agoThat also doesn't make sense: No matter what, you're going to have to parse the returned document linearly, everything in it is therefore equivalent to a list in performance. Random-access structures like dictionaries, hashmaps make no sense in this context: It would be stupid if you had to do extra work to tell graphql what your preferred key parameter(s) are so that it can create a dictionary, and then you get list-like performance anyway.
- kehrin 4y agoBut can't you? During development I had this with errors, where I just enter "error" as a key in my query, but the actual data was JSON. So it had keys that I didn't specify, but that I received non-the-less.
- nawgz 4y agoIt's true there's nothing in the spec preventing from returning that kind of thing, for instance a JSONB column in your underlying RDBMS would probably lead to what you describe, but it's more that when using SQL you can make "anonymous" queries where you say "give me all columns, I'll deal with their names myself", while GQL is more like "give me all these keys" and there's no way to not specify the key. I don't have great language tools to speak precisely here, hope it makes sense.
- the_mitsuhiko 4y agoGraphQL has no native map type which means if you have a map data structure you cannot represent it within the type system.