uuidv7filename

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractUUIDv7

func ExtractUUIDv7(s string) (uuid.UUID, error)

ExtractUUIDv7 parses and validates a UUIDv7 string.

func NewUUIDv7String

func NewUUIDv7String() (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL