uuid

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2021 License: CC0-1.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UUID_TIMESTAMP    = 122192928000000000
	V1                = ^(1 << 15) & ^(1 << 14) & ^(1 << 13)
	V4                = ^(1 << 15) & ^(1 << 13) & ^(1 << 12)
	V3                = ^(1 << 15) & ^(1 << 14)
	V5                = ^(1 << 15) & ^(1 << 13)
	SET_3MSB          = ^(1 << 15) & ^(1 << 14) & ^(1 << 13)
	SET_4MSB          = ^(1 << 15) & ^(1 << 14) & ^(1 << 13) & ^(1 << 12)
	DCE_VARIANT       = ^(1 << 14)
	MICROSOFT_VARIANT = ^(1 << 13)
)

Variables

View Source
var (
	DNS_NAMESPACE = []byte{
		0x6b,
		0xa7,
		0xb8,
		0x10,
		0x9d,
		0xad,
		0x11,
		0xd1,
		0x80,
		0xb4,
		0x00,
		0xc0,
		0x4f,
		0xd4,
		0x30,
		0xc8,
	}
	URL_NAMESPACE = []byte{
		0x6b,
		0xa7,
		0xb8,
		0x11,
		0x9d,
		0xad,
		0x11,
		0xd1,
		0x80,
		0xb4,
		0x00,
		0xc0,
		0x4f,
		0xd4,
		0x30,
		0xc8,
	}
	OID_NAMESPACE = []byte{
		0x6b,
		0xa7,
		0xb8,
		0x12,
		0x9d,
		0xad,
		0x11,
		0xd1,
		0x80,
		0xb4,
		0x00,
		0xc0,
		0x4f,
		0xd4,
		0x30,
		0xc8,
	}
	X500_NAMESPACE = []byte{
		0x6b,
		0xa7,
		0xb8,
		0x14,
		0x9d,
		0xad,
		0x11,
		0xd1,
		0x80,
		0xb4,
		0x00,
		0xc0,
		0x4f,
		0xd4,
		0x30,
		0xc8,
	}
)

Functions

This section is empty.

Types

type UUID

type UUID struct {
	TimeLow            uint32
	TimeMid            uint16
	TimeHighAndVersion uint16
	ClockAndVariant    uint16
	Node               []byte
}

func NewUUID

func NewUUID(version int, args map[string]string) (*UUID, error)

Creates a new UUID. Custom namespaces must be a valid string representation of an UUID.

The accepted args keys/values are:

[variant]:
	microsoft | dce | future
[name]:
	valid string
[namespace]:
	dns | url | oid | x500 | custom

func (*UUID) Stringify

func (uuid *UUID) Stringify() string

Serialize an UUID to a hex string representation.

Output example:

1cedfbc2-676a-499f-8079-b5177528c26a

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL