add uuid functions

This commit is contained in:
2025-11-21 10:29:40 -05:00
parent 193abbd2ce
commit 8b2ca71f6b
4 changed files with 50 additions and 0 deletions

17
uuid.go Normal file
View 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()
}