18 lines
441 B
Go
18 lines
441 B
Go
package rand
|
|
|
|
import "github.com/google/uuid"
|
|
|
|
// UUIDv4 generates a RFC 9562 Version 4 UUID
|
|
// using only random bytes in the format:
|
|
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
|
func UUIDv4() string {
|
|
return uuid.New().String()
|
|
}
|
|
|
|
// UUIDv7 generates a RFC 9562 Version 7 UUID
|
|
// using the current time and random bytes in the format:
|
|
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
|
|
func UUIDv7() string {
|
|
return uuid.Must(uuid.NewV7()).String()
|
|
}
|