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

feat: UUIDs slice type with Strings() convenience method #133

Merged
merged 4 commits into from Oct 26, 2023
Merged

feat: UUIDs slice type with Strings() convenience method #133

merged 4 commits into from Oct 26, 2023

Conversation

dzbee
Copy link
Contributor

@dzbee dzbee commented Oct 25, 2023

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.

@dzbee dzbee requested a review from a team as a code owner October 25, 2023 15:46
@dzbee dzbee changed the title UUIDs slice type with Strings() convenience method feat: UUIDs slice type with Strings() convenience method Oct 25, 2023
uuid.go Show resolved Hide resolved
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
Copy link
Collaborator

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.

Copy link
Collaborator

@bormanp bormanp 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 for your addition to the UUID package.

@bormanp bormanp merged commit cd5fbbd into google:master Oct 26, 2023
6 checks passed
gcf-merge-on-green bot pushed a commit that referenced this pull request Oct 26, 2023
🤖 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).
@loeffel-io
Copy link

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

@dzbee dzbee deleted the feature/strings-from-slices branch October 27, 2023 19:12
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.

None yet

3 participants