go-winio: github.com/microsoft/go-winio/pkg/guid Index | Files

package guid

import "github.com/microsoft/go-winio/pkg/guid"

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

Package Files

guid.go

type GUID Uses

type GUID windows.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 FromArray Uses

func FromArray(b [16]byte) GUID

FromArray constructs a GUID from a big-endian encoding array of 16 bytes.

func FromString Uses

func FromString(s string) (GUID, error)

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 Uses

func FromWindowsArray(b [16]byte) GUID

FromWindowsArray constructs a GUID from a Windows encoding array of bytes.

func NewV4 Uses

func NewV4() (GUID, error)

NewV4 returns a new version 4 (pseudorandom) GUID, as defined by RFC 4122.

func (GUID) MarshalText Uses

func (g GUID) MarshalText() ([]byte, error)

MarshalText returns the textual representation of the GUID.

func (GUID) String Uses

func (g GUID) String() string

func (GUID) ToArray Uses

func (g GUID) ToArray() [16]byte

ToArray returns an array of 16 bytes representing the GUID in big-endian encoding.

func (GUID) ToWindowsArray Uses

func (g GUID) ToWindowsArray() [16]byte

ToWindowsArray returns an array of 16 bytes representing the GUID in Windows encoding.

func (*GUID) UnmarshalText Uses

func (g *GUID) UnmarshalText(text []byte) error

UnmarshalText takes the textual representation of a GUID, and unmarhals it into this GUID.

func (GUID) Variant Uses

func (g GUID) Variant() Variant

Variant returns the GUID variant, as defined in RFC 4122.

func (GUID) Version Uses

func (g GUID) Version() Version

Version returns the GUID version, as defined in RFC 4122.

type Variant Uses

type Variant uint8

Variant specifies which GUID variant (or "type") of the GUID. It determines how the entirety of the rest of the GUID is interpreted.

const (
    // VariantUnknown specifies a GUID variant which does not conform to one of
    // the variant encodings specified in RFC 4122.
    VariantUnknown Variant = iota
    VariantNCS
    VariantRFC4122
    VariantMicrosoft
    VariantFuture
)

The variants specified by RFC 4122.

type Version Uses

type Version uint8

Version specifies how the bits in the GUID were generated. For instance, a version 4 GUID is randomly generated, and a version 5 is generated from the hash of an input string.

Package guid imports 6 packages (graph). Updated 2019-05-21. Refresh now. Tools for package owners.