diff options
author | jackterm <76983241+jackterm@users.noreply.github.com> | 2021-01-22 13:20:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-22 12:20:15 -0600 |
commit | bfb86fa49a73e4194d93bea18d7acfe3694438ce (patch) | |
tree | c6c39d2ec7a3f0d6d26ce4a4e5e05056aed1995d | |
parent | b5d0d36c983b13c35a93a356a9d2c14da0a1c3ab (diff) | |
download | google-uuid-bfb86fa49a73e4194d93bea18d7acfe3694438ce.tar.gz |
Add NewString Func (#73)
* added utility func
* updated docs & function call
-rw-r--r-- | version4.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/version4.go b/version4.go index c110465..86160fb 100644 --- a/version4.go +++ b/version4.go @@ -14,6 +14,14 @@ func New() UUID { return Must(NewRandom()) } +// NewString creates a new random UUID and returns it as a string or panics. +// NewString is equivalent to the expression +// +// uuid.New().String() +func NewString() string { + return Must(NewRandom()).String() +} + // NewRandom returns a Random (Version 4) UUID. // // The strength of the UUIDs is based on the strength of the crypto/rand |