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

Add Enum.Match #9

Merged
merged 2 commits into from
Apr 12, 2024
Merged

Add Enum.Match #9

merged 2 commits into from
Apr 12, 2024

Conversation

iwata
Copy link
Contributor

@iwata iwata commented Apr 12, 2024

Add Matcher interface and Match method to Enum for custom matching logic.
This is especially beneficial when the value type is struct, which means that be able to implement a custom matcher.

…m matching logic

✅ (enum_test.go): Add tests for new Match method in Enum, testing with Book and Color enums
Copy link
Member

@orsinium orsinium left a comment

Choose a reason for hiding this comment

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

Thank you! It seems like a cool idea. I left a few suggestions, to make the API more in the spirit of the package.

enum.go Outdated Show resolved Hide resolved
enum.go Outdated Show resolved Hide resolved
… Equal for better clarity

✨ (enum.go): Add Parse function to replace Match method for better separation of concerns
🐛 (enum_test.go): Update tests to reflect changes in enum.go, replacing Match with Parse and updating test names
@iwata iwata requested a review from orsinium April 12, 2024 11:56
@iwata
Copy link
Contributor Author

iwata commented Apr 12, 2024

@orsinium PTAL

@orsinium
Copy link
Member

Beautiful! Thank you.

@orsinium orsinium merged commit 2a22286 into orsinium-labs:master Apr 12, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants