-
Notifications
You must be signed in to change notification settings - Fork 371
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
feat: UUIDs slice type with Strings() convenience method #133
Conversation
uuid.go
Outdated
// UUIDs is a slice of UUID types | ||
type UUIDs []UUID | ||
|
||
// Strings returns a slice of the string form of each UUID in the received slice of UUIDs |
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.
// Strings returns a string slice containing the string form of each UUID in uuids.
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.
Thank you for your addition to the UUID package.
🤖 I have created a release *beep* *boop* --- ## [1.4.0](https://togithub.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26) ### Features * UUIDs slice type with Strings() convenience method ([#133](https://togithub.com/google/uuid/issues/133)) ([cd5fbbd](https://togithub.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4)) ### Fixes * Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Would love to see also the Scanner and Value interface for the UUID slice in this pkg - i could create a PR for this if there is some interest |
* feat: add uuid slice type with strings convenience method * test: benchmark new UUIDs.Strings() feature * docs: improve comments on UUIDs * fix: typos in UUIDs strings benchmark
🤖 I have created a release *beep* *boop* --- ## [1.4.0](https://togithub.com/google/uuid/compare/v1.3.1...v1.4.0) (2023-10-26) ### Features * UUIDs slice type with Strings() convenience method ([google#133](https://togithub.com/google/uuid/issues/133)) ([cd5fbbd](https://togithub.com/google/uuid/commit/cd5fbbdd02f3e3467ac18940e07e062be1f864b4)) ### Fixes * Clarify that Parse's job is to parse but not necessarily validate strings. (Documents current behavior) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
I often work with slices of UUIDs and want to include them in log messages. It is therefore convenient to be able to easily transform a slice of UUIDs into a slice of strings. In the interest of avoiding repeating code across many projects to accomplish this, I suggest defining a slice type in this project.
This PR adds such a type and defines a convenience method
Strings()
on it.This type additionally gives maintainers the opportunity to add further convenience methods; for instance one could implement the sort interface on this new type.