iris/_examples/auth/jwt/tutorial/util/uuid.go
Gerasimos (Makis) Maropoulos 579c3878f0
add a jwt tutorial + go client
2020-11-04 21:12:13 +02:00

24 lines
379 B
Go

package util
import "github.com/google/uuid"
// MustGenerateUUID returns a new v4 UUID or panics.
func MustGenerateUUID() string {
id, err := GenerateUUID()
if err != nil {
panic(err)
}
return id
}
// GenerateUUID returns a new v4 UUID.
func GenerateUUID() (string, error) {
id, err := uuid.NewRandom()
if err != nil {
return "", err
}
return id.String(), nil
}