add uuid functions
This commit is contained in:
17
uuid.go
Normal file
17
uuid.go
Normal file
@@ -0,0 +1,17 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user