Skip to content

Conversation

@LucaCappelletti94
Copy link
Contributor

Since my last PR adding the missing From impls for Statement enum variants to convert any given variant X into Statement::X(X) using the From trait, several such X variants have been added without the associated From impl.

This PR adds several (I hope all) missing From impls, and reasonably cleans up some of the code which was using the more verbose conversion.

Luca

or_replace: bool,
temporary: bool,
) -> Result<Statement, ParserError> {
) -> Result<CreateFunction, ParserError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I followed the intent of this diff - we're changing the public APIs to return not an actual statement anymore but its not clear to me why that's a desirable change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made it so all of these type of function return the strictest concrete variant, which is the thing they actually return, so that in practice one can write:

let my_specific_variant = parse_my_specific_variant(...)?

instead of:

let Statement::MySpecificVariant(my_specific_variant) = parse_my_specific_variant(...)? else {
    unreachable!();
};

which seems much cleaner.

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.

2 participants