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

Output an all-uppercase xid. #108

Open
heiwa9 opened this issue Nov 1, 2024 · 2 comments
Open

Output an all-uppercase xid. #108

heiwa9 opened this issue Nov 1, 2024 · 2 comments

Comments

@heiwa9
Copy link

heiwa9 commented Nov 1, 2024

Is it possible to add a new configuration option to the New() function to generate xids that are entirely uppercase?

I've used machine translation for the above, so please forgive me if anything is unclear.

@koenbollen
Copy link

A quick solution to get uppercase xids is this:

id := strings.ToUpper(xid.New().String())
fmt.Println(id)

(see in action: https://go.dev/play/p/RzGk4liYi0_L)

I'm not sure this library needs an option for this.

@heiwa9
Copy link
Author

heiwa9 commented Nov 2, 2024

A quick solution to get uppercase xids is this:

id := strings.ToUpper(xid.New().String())
fmt.Println(id)

(see in action: https://go.dev/play/p/RzGk4liYi0_L)

I'm not sure this library needs an option for this.

Although the effect is the same, I don't know if there is any difference in performance. Because I see that the internal implementation is generated by a character array, in theory, it should be possible to achieve it by directly changing the character array.

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

No branches or pull requests

2 participants