Documentation ¶
Overview ¶
Package guid provides a GUID type. The backing structure for a GUID is identical to that used by the golang.org/x/sys/windows GUID type. There are two main binary encodings used for a GUID, the big-endian encoding, and the Windows (mixed-endian) encoding. See here for details: https://en.wikipedia.org/wiki/Universally_unique_identifier#Encoding
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GUID ¶
GUID represents a GUID/UUID. It has the same structure as golang.org/x/sys/windows.GUID so that it can be used with functions expecting that type. It is defined as its own type so that stringification and marshaling can be supported. The representation matches that used by native Windows code.
func FromString ¶
FromString parses a string containing a GUID and returns the GUID. The only format currently supported is the `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` format.
func FromWindowsArray ¶
FromWindowsArray constructs a GUID from a Windows encoding array of bytes.
func NewV5 ¶
NewV5 returns a new version 5 (generated from a string via SHA-1 hashing) GUID, as defined by RFC 4122. The RFC is unclear on the encoding of the name, and the sample code treats it as a series of bytes, so we do the same here.
Some implementations, such as those found on Windows, treat the name as a big-endian UTF16 stream of bytes. If that is desired, the string can be encoded as such before being passed to this function.
func (GUID) MarshalText ¶
MarshalText returns the textual representation of the GUID.
func (GUID) ToArray ¶
ToArray returns an array of 16 bytes representing the GUID in big-endian encoding.
func (GUID) ToWindowsArray ¶
ToWindowsArray returns an array of 16 bytes representing the GUID in Windows encoding.
func (*GUID) UnmarshalText ¶
UnmarshalText takes the textual representation of a GUID, and unmarhals it into this GUID.