From c098704c8f1c4828a0454158e50700ff749a1d96 Mon Sep 17 00:00:00 2001 From: Mohammad Heidari Date: Mon, 13 Jul 2026 13:32:01 +0200 Subject: [PATCH] feat: add shorthand function for string UUIDv7 --- version7.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/version7.go b/version7.go index 3fec671..95eac2d 100644 --- a/version7.go +++ b/version7.go @@ -42,6 +42,14 @@ func NewV7FromReader(r io.Reader) (UUID, error) { return uuid, nil } +// NewV7String creates a new random UUID and returns it as a string or panics. +// NewV7String is equivalent to the expression +// +// uuid.Must(uuid.NewV7()).String() +func NewV7String() string { + return Must(NewV7()).String() +} + // makeV7 fill 48 bits time (uuid[0] - uuid[5]), set version b0111 (uuid[6]) // uuid[8] already has the right version number (Variant is 10) // see function NewV7 and NewV7FromReader