# README
uuid
Package uuid implements UUID RFC 4122.
Usage
Generating
Time-Based (Version 1)
uuid.NewTimeBased() (uuid.UUID, error)
uuid.NewV1() (uuid.UUID, error)
DCE Security (Version 2)
uuid.NewDCESecurity(uuid.Domain) (uuid.UUID, error)
uuid.NewV2(uuid.Domain) (uuid.UUID, error)
Name-Based uses MD5 hashing (Version 3)
uuid.NewNameBasedMD5(namespace, name string) (uuid.UUID, error)
uuid.NewV3(namespace, name string) (uuid.UUID, error)
Random (Version 4)
uuid.NewRandom() (uuid.UUID, error)
uuid.NewV4() (uuid.UUID, error)
Name-Based uses SHA-1 hashing (Version 5)
uuid.NewNameBasedSHA1(namespace, name string) (uuid.UUID, error)
uuid.NewV5(namespace, name string) (uuid.UUID, error)
Styles
- Standard: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12, length: 36)
- Without Dash: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (length: 32)
Formatting & Parsing
uuid.UUID.String() string // format to standard style
uuid.UUID.Format(uuid.Style) string // format to uuid.StyleStandard or uuid.StyleWithoutDash
uuid.Parse(string) (uuid.UUID, error) // parse from UUID string
# Functions
IsValid reports whether the passed string is a valid uuid string.
New is short of NewRandom.
NewDCESecurity returns a new DCE security UUID (version 2).
NewNameBasedMD5 returns a new name based UUID with MD5 hash (version 3).
NewNameBasedSHA1 returns a new name based UUID with SHA1 hash (version 5).
NewRandom returns a new random UUID (version 4).
NewTimeBased returns a new time based UUID (version 1).
NewV1 is short of NewTimeBased.
NewV2 is short of NewDCESecurity.
NewV3 is short of NewNameBasedMD5.
NewV4 is short of NewRandom.
NewV5 is short of NewNameBasedSHA1.
Parse parses the UUID string.
# Constants
DomainGroup represents POSIX GID domain.
DomainUser represents POSIX UID domain.
LayoutFuture represents the layout: Reserved for future definition.
LayoutInvalid represents invalid layout.
LayoutMicrosoft represents the layout: Reserved, Microsoft Corporation backward compatibility.
LayoutNCS represents the layout: Reserved, NCS backward compatibility.
LayoutRFC4122 represents the layout: The variant specified in RFC 4122.
"6ba7b810-9dad-11d1-80b4-00c04fd430c8".
"6ba7b812-9dad-11d1-80b4-00c04fd430c8".
"6ba7b811-9dad-11d1-80b4-00c04fd430c8".
"6ba7b814-9dad-11d1-80b4-00c04fd430c8".
StyleStandard represents the standard style of UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (8-4-4-4-12, length: 36).
StyleWithoutDash represents the style without dash of UUID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (length: 32).
Short names of versions.
Short names of versions.
Short names of versions.
Short names of versions.
Short names of versions.
VersionDCESecurity represents the DCE security version, with embedded POSIX UIDs (Version 2).
VersionNameBasedMD5 represents the name-based version that uses MD5 hashing (Version 3).
VersionNameBasedSHA1 represents the name-based version that uses SHA-1 hashing (Version 5).
VersionRandom represents the randomly or pseudo-randomly generated version (Version 4).
VersionTimeBased represents the time-based version (Version 1).
VersionUnknown represents unknown version.
# Variables
Nil represents the Nil UUID (00000000-0000-0000-0000-000000000000).