You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that json is the vehicle to transport data from a server. But when the data is retrieved locally, it could also be stored in a hash. This would also be nice when I want to use lazy arrays or other object types which cannot be transported using json.
The text was updated successfully, but these errors were encountered:
I originally made hashes to hold all the data. I added "GraphQL::Response" for a few reasons.
One, to comply with the GraphQL spec, the order of the returns must match the order of the items in the JSON. Personally I think that violates the spirit of JSON and hashes, but there it is.
If you ask for "{ a b }" it must return
{
"a" : ...
"b" : ...
}
It can't return 'b' then 'a'..
GraphQL::Response also awaits any promises it finds, so you can return Promises throughout your results if you are still calculating the actual result. Once all the execution occurs, it walks the graph again to construct the actual JSON, awaiting any promises. This allows multiple results to be calculated in parallel. I haven't done much with that yet, but that was the idea ;). If anything about the interface is awkward, feel free to propose alternatives.
hi Curt,
Thanks for your answer. I've read that too from the spec. But I thought that it would be easier to return the data still in their perl6 context, but yes it violates the spec. I can also read out your structure instead of calling to-json on it.
Regards,
Marcel
I understand that json is the vehicle to transport data from a server. But when the data is retrieved locally, it could also be stored in a hash. This would also be nice when I want to use lazy arrays or other object types which cannot be transported using json.
The text was updated successfully, but these errors were encountered: