-
Notifications
You must be signed in to change notification settings - Fork 602
Use identifiable structs for AST variant fields #311
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
Comments
Is the primary usecase of this proposal so that downstream code can re-use |
Yes, exactly. |
I totally agree with this proposal. This would simplify my code considerably. I've got structs that are complete translations of some enum variants. |
I forked the project and made those changes if you want to see how it would look. |
I don't feel qualified to approve / accept this level of change without some additional buy in from @nickolay / @andygrove / @Dandandan . #311 (comment) seems like a good usecase to me but it is a pretty major change for all users of sqlparser-rs. |
#40 could be marked as a duplicate of this issue as well. As mentioned there, I didn't think creating a separate struct for every single variant (even those holding one or two fields) of every enum was worth the breakage, but extracting complex variants like In #315 (comment) @Dandandan suggested doing this for all variants of the |
Your guidance makes a lot of sense to me @nickolay -- thank you |
Sadly I don't have the time to help drive projects such as this. Unless one of the other maintainers wants to do so, PRs like this are not likely to be merged. I am sorry I don't have the time and I am sorry if your time was wasted. As the current state of affairs might not have been clear in the project's README. I have added #416 to try and help |
When consuming the generated AST for further processing, one needs to match against and deconstruct
ast::Statement
instances. Currently, the fields of this enum's variants are defined inline... which makes it impossible for downstream code to represent the nested structures as types. For example, consider this structure:https://github.com/ballista-compute/sqlparser-rs/blob/35ef0eee3857c59827b2587bc813218a00dce264/src/ast/mod.rs#L490-L497
I propose we migrate to the following pattern.
Obviously this is a massive breaking change, but that seems OK given the
0.9.x
crates.io version.Thoughts?
The text was updated successfully, but these errors were encountered: