Comments (9)
Personally, I'd argue that this would be an unnecessary extension, since it would essentially be 1-line pass-through calls to base64.UrlEncoding.EncodeToString(u.Bytes())
and base32.StdEncoding.EncodeToString(u.Bytes())
.
from uuid.
I think Parse()
could be extended easily enough to accommodate decoding base58/base64/base32 strings without disrupting existing functionality, but String()
, Format()
, and MarshalText()
all have established behavior and adding a new Base58String()
method feels clunky.
from uuid.
I don't really like Short()
/FromShort()
. Those names feel obtuse to me and would obviously need documentation to clarify what they do. If we pick base58 then I would go with explicit Base58String()
/FromBase58String()
. It's clunky but it's also obvious and unsurprising, which I think is more important for a library like this.
from uuid.
What's the use case? I personally never seen it encoded anything but binary or hex-string.
from uuid.
One use case is when I use UUIDs in URLs. Base64 produces shorter string representation. in case I need shorter case-insensitive UUID string I use Base32.
from uuid.
Equivalent functionality is https://www.npmjs.com/package/short-uuid
from uuid.
I have a wrapper which uses base58, a handy middle ground which is used widely https://github.com/wolfeidau/shortuuid, as you say it is a pretty simple wrapper around existing UUID libraries.
Keen to migrate this to this library so i can try out v6 UUIDs.
from uuid.
Doing a little research on the topic, I think we should use base58 as is done with @wolfeidau's package.
Similar to Base64, but modified to avoid both non-alphanumeric characters (+ and /) and letters that might look ambiguous when printed (0 – zero, I – capital i, O – capital o and l – lower-case L). Base58 is used to represent bitcoin addresses.[citation needed] Some messaging and social media systems break lines on non-alphanumeric strings. This is avoided by not using URI reserved characters such as +.
https://en.wikipedia.org/wiki/Binary-to-text_encoding#Base58
from uuid.
I agree on the clunkiness and the potential verbosity of maintaining a bunch of permutations of different base values. How would you feel about a pair of functions that worked like String()
and Parse()
and we just be opinionated about it being base58
?
Short()
FromShort()
from uuid.
Related Issues (20)
- 运行go命令报错/gofrs/[email protected]+incompatible HOT 1
- Does this produce cryptographically strong uuid values? HOT 3
- V7 and project status HOT 9
- `uuid.UUID.Value` panics with nil pointers HOT 2
- Add a generator's constructor with custom `io.Reader` as rand data source HOT 2
- Link to new UUID draft HOT 4
- add max uuid with all bits set. HOT 12
- Missing TimestampFromV7 HOT 1
- TimestampFromV7 should return the unix timestamp in milliseconds HOT 9
- Mixed pointer and value recivers HOT 4
- Wrong error message for TimestampFromV7 HOT 1
- v5.1.0 is tagged incorrectly HOT 2
- Tune up Fuzz test HOT 2
- Ability to encode specific timestamp into a V1 UUID HOT 3
- create go.mod and go.sum HOT 19
- Support for Go 1.13 Error Wrapping HOT 9
- Why does Timestamp.Time return an error? HOT 7
- potential security risk with codecov ? HOT 3
- consider adding IsZero() property HOT 3
- Proposal: to release as a Go Module, archive repo and fork to github.com/gofrs/[email protected] HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uuid.