Skip to content
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

Refactor: Replace Traditional Switch Statements with Switch Expressions #1671

Closed

Conversation

alxkm
Copy link
Contributor

@alxkm alxkm commented Nov 4, 2024

This PR refactors several components to replace traditional switch statements with the new switch expressions.
This change enhances code readability, reduces the risk of fall-through errors, and allows for a more concise syntax.

Changes Made
Files Updated:

AzureAiSearchFilterExpressionConverter
MilvusFilterExpressionConverter
RedisFilterExpressionConverter
RedisVectorStore
TypesenseFilterExpressionConverter
WeaviateFilterExpressionConverter

Key Modifications:

Replaced traditional switch statements with switch expressions in the listed files.
Improved syntax by utilizing arrow (->) syntax for case actions, removing the need for explicit break statements.
Added default cases to handle unknown message types more cleanly.

Benefits
Improved Readability: The new switch expressions simplify the code structure, making it easier to follow.
Reduced Errors: Eliminating fall-through behavior minimizes the potential for bugs.
Direct Value Assignment: The ability to return values directly enhances code clarity and intent.

@ilayaperumalg ilayaperumalg self-assigned this Nov 5, 2024
@ilayaperumalg ilayaperumalg added this to the 1.0.0-M4 milestone Nov 5, 2024
@markpollack
Copy link
Member

Thanks!

merged in 6a3c548

@markpollack markpollack closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants