Documentation ¶
Overview ¶
Package uuid implements Universally Unique Identifier (UUID) handling, as specified by RFC 4122.
Index ¶
- type UUID
- func (id UUID) ClkSeq() uint16
- func (id UUID) ClkSeqHiAndVariant() (uint8, Variant)
- func (id UUID) ClkSeqLow() uint8
- func (id UUID) Compare(id2 UUID) int
- func (id UUID) Node() []byte
- func (id *UUID) Set(data []byte)
- func (id UUID) String() string
- func (id UUID) Time() uint64
- func (id UUID) TimeHiAndVersion() uint16
- func (id UUID) TimeLow() uint32
- func (id UUID) TimeMid() uint16
- func (id UUID) Version() uint8
- type Variant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UUID ¶
type UUID [16]byte
UUID is an Universally Unique IDentifier, as defined by RFC 4122. The UUID represents the UUID in its binary encoding. The RFC 4122 specifies the encoding and fields as follows.
The fields are encoded as 16 octets, with the sizes and order of the fields defined above, and with each field encoded with the Most Significant Byte first (known as network byte order). Note that the field names, particularly for multiplexed fields, follow historical practice.
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | time_low | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | time_mid | time_hi_and_version | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |clk_seq_hi_res | clk_seq_low | node (0-1) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | node (2-5) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
If the UUID variant is `Microsoft', the first 3 elements are encoded in little-endian format. This has practically no affect unless you have to match ASCII and binary UUIDs in which case the equality differs between variants.
var Nil UUID
Nil UUID is a special case UUID which has all bits set to zero.
func MustParse ¶
MustParse parses the UUID string. The function panics if the argument string is not a valid UUID.
func (UUID) ClkSeqHiAndVariant ¶
ClkSeqHiAndVariant returns the clock sequence hi-order bits and variant.
func (UUID) Compare ¶
Compare compares the UUID to the argument UUID. The function returns -1, 0, 1 if this UUID is smaller, equal, or greater than the argument UUID respectively.
func (UUID) TimeHiAndVersion ¶
TimeHiAndVersion returns the timestamp high-order bits and version number.