Skip to content

Conversation

@LucaCappelletti94
Copy link
Contributor

This PR refactors several Statement enum variants into their own dedicated structs. This follows the pattern of recent refactors to improve the modularity and type safety of the AST.

Specifically, the following statements have been extracted:

  • CreatePolicy
  • DropPolicy
  • AlterPolicy
  • Grant
  • Revoke

I implemented From<Struct> for Statement and fmt::Display for each new struct.

As done in PR #2160 and for the same reasons, I have updated parser methods to return the specific struct type instead of the generic Statement enum:
- parse_create_policy() -> Result<CreatePolicy, ...>
- parse_drop_policy() -> Result<DropPolicy, ...>
- parse_alter_policy() -> Result<AlterPolicy, ...>
- parse_grant() -> Result<Grant, ...>
- parse_revoke() -> Result<Revoke, ...>

This PR does not yet cover all Statement struct variants that likely should be converted into tuple variants, we'll get there in time.

Luca

@LucaCappelletti94 LucaCappelletti94 marked this pull request as ready for review January 31, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant