Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractUUIDv7 ¶
ExtractUUIDv7 parses and validates a UUIDv7 string.
func NewUUIDv7String ¶
Types ¶
type UUIDv7FileInfo ¶
type UUIDv7FileInfo struct {
ID string
Suffix string
// Without leading dot.
Extension string
// Full filename with extension.
FileName string
Time time.Time
}
UUIDv7FileInfo provides UUIDv7 based filenames "<uuid>_<sanitised-64-char-suffix>.<ext>".
func Build ¶
func Build(id, suffix, extension string) (UUIDv7FileInfo, error)
Build constructs a filename of the form "<uuid>_<sanitized-suffix>.<extension>". Note: The Suffix is lossy- non-alphanumeric characters are replaced with underscores and the suffix is truncated to 64 characters. The original suffix cannot be fully recovered from the filename.
func Parse ¶
func Parse(filename string) (UUIDv7FileInfo, error)
Parse extracts the UUID, suffix, and extension from a filename produced by Build. Note: The Suffix is only an approximation of the original input as build is lossy. Underscores in the filename are converted to spaces, and any original non-alphanumeric characters or underscores cannot be exactly recovered.