From bfb86fa49a73e4194d93bea18d7acfe3694438ce Mon Sep 17 00:00:00 2001 From: jackterm <76983241+jackterm@users.noreply.github.com> Date: Fri, 22 Jan 2021 13:20:15 -0500 Subject: [PATCH] Add NewString Func (#73) * added utility func * updated docs & function call --- version4.go | 8 ++++++++ 1 file changed, 8 insertions(+) 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