# README
uuid
The uuid package generates and inspects UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
This package is based on the github.com/pborman/uuid package (previously named code.google.com/p/go-uuid). It differs from these earlier packages in that a UUID is a 16 byte array rather than a byte slice. One loss due to this change is the ability to represent an invalid UUID (vs a NIL UUID).
Install
go get github.com/google/uuid
Documentation
Full go doc
style documentation for the package can be viewed online without
installing this package by using the GoDoc site here:
http://pkg.go.dev/github.com/google/uuid
# Functions
ClockSequence returns the current clock sequence, generating one if not already set.
DisableRandPool disables the randomness pool if it was previously enabled with EnableRandPool.
EnableRandPool enables internal randomness pool used for Random (Version 4) UUID generation.
FromBytes creates a new UUID from a byte slice.
GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and clock sequence as well as adjusting the clock sequence as needed.
IsInvalidLengthError is matcher function for custom error invalidLengthError.
Must returns uuid if err is nil and panics otherwise.
MustParse is like Parse but panics if the string cannot be parsed.
New creates a new random UUID or panics.
NewDCEGroup returns a DCE Security (Version 2) UUID in the group domain with the id returned by os.Getgid.
NewDCEPerson returns a DCE Security (Version 2) UUID in the person domain with the id returned by os.Getuid.
NewDCESecurity returns a DCE Security (Version 2) UUID.
NewHash returns a new UUID derived from the hash of space concatenated with data generated by h.
NewMD5 returns a new MD5 (Version 3) UUID based on the supplied name space and data.
NewRandom returns a Random (Version 4) UUID.
NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.
NewSHA1 returns a new SHA1 (Version 5) UUID based on the supplied name space and data.
NewString creates a new random UUID and returns it as a string or panics.
NewUUID returns a Version 1 UUID based on the current NodeID and clock sequence, and the current time.
UUID version 6 is a field-compatible version of UUIDv1, reordered for improved DB locality.
UUID version 7 features a time-ordered value field derived from the widely implemented and well known Unix Epoch timestamp source, the number of milliseconds seconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
NewV7FromReader returns a Version 7 UUID based on the current time(Unix Epoch).
NodeID returns a slice of a copy of the current Node ID, setting the Node ID if not already set.
NodeInterface returns the name of the interface from which the NodeID was derived.
Parse decodes s into a UUID or returns an error if it cannot be parsed.
ParseBytes is like Parse, except it parses a byte slice instead of a string.
SetClockSequence sets the clock sequence to the lower 14 bits of seq.
SetNodeID sets the Node ID to be used for Version 1 UUIDs.
SetNodeInterface selects the hardware address to be used for Version 1 UUIDs.
SetRand sets the random number generator to r, which implements io.Reader.
Validate returns an error if s is not a properly formatted UUID in one of the following formats: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} It returns an error if the format is invalid, otherwise nil.
# Constants
Reserved for future definition.
Domain constants for DCE Security (Version 2) UUIDs.
Invalid UUID.
Reserved, Microsoft Corporation backward compatibility.
Domain constants for DCE Security (Version 2) UUIDs.
Domain constants for DCE Security (Version 2) UUIDs.
Reserved, NCS backward compatibility.
The variant specified in RFC4122.
# Variables
The Max UUID is special form of UUID that is specified to have all 128 bits set to 1.
Well known namespace IDs and UUIDs.
Well known namespace IDs and UUIDs.
Well known namespace IDs and UUIDs.
Well known namespace IDs and UUIDs.
empty UUID, all zeros.
# Type aliases
A Domain represents a Version 2 domain.
A Time represents a time as the number of 100's of nanoseconds since 15 Oct 1582.
A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC 4122.
UUIDs is a slice of UUID types.
A Variant represents a UUID's variant.
A Version represents a UUID's version.