-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
please document the format of the AST #45
Comments
I'm not sure what you refer specifically. I think there are two possible formats: |
what i mean is, i'd like to write a function to map the GraphQL AST onto an AST for a different query language (SQL, Cypher, Gremlin, CQL, Redis, Mongo) etc etc -- is there a way to traverse the AST and transform it into a different language? |
Well, I usually use normal functions and matches. Since every node is unique. And having a method per node type or similar usually not very convenient in Rust (because either requires borrow checker hacks, or a lot of unwrapping optionals). There are #26 and #31 but none of them is merged because I don't have enough time to work on them. |
all i mean is, in the docs, can you put an example of what the ast looks like? not a big deal, but right now the docs just show the AST as equivalent to the query string:
if AST is the same thing as the query, then "parse_query" doesn't actually do anything. I thought the AST was a Tree, not a string! Why do we want the AST to be a string? |
It's just that "Display" trait of the AST outputs the query. This is convenient if you want to extract a piece of query or modify query and convert back to string. To see AST nodes use debug output: |
in the docs, you show the result of printing the AST -- what's the format of the data structure? It would be handy to look at. Is it just a nested JSON?
The text was updated successfully, but these errors were encountered: