-
Notifications
You must be signed in to change notification settings - Fork 122
Add IsZero method to UUID type for MongoDB omitzero support #226
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: cameracker <[email protected]>
…nd GitHub issue Co-authored-by: cameracker <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #226 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 517 519 +2
=========================================
+ Hits 517 519 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an IsZero() method to the UUID type to enable MongoDB omitzero tag functionality by conforming to the bsoncodec.Zeroer interface.
- Adds
IsZero()method that behaves identically to existingIsNil()method - Includes comprehensive test coverage for both zero and non-zero UUID cases
- Provides clear documentation referencing the MongoDB use case and GitHub issue
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| uuid.go | Adds IsZero() method with documentation referencing MongoDB bsoncodec.Zeroer interface |
| uuid_test.go | Adds test function testUUIDIsZero with coverage for zero and non-zero cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Ha, that was fun :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not bad for a robot ;-)
seems to be confusing the merge approvals
Implementation Complete!
Added a new
IsZero()method to the UUID type that:trueif the UUID is equal to the zero value (uuid.Nil)IsNil()methodbsoncodec.ZeroerinterfaceThe minimal change adds exactly what was requested - a method to support MongoDB's omitzero tag feature while maintaining full compatibility with existing code.
Original prompt
Fixes #224
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.