uuids

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package uuids provides functions for generating and handling UUIDs as defined by RFC 4122.

Index

Constants

This section is empty.

Variables

View Source
var (
	DNS  = UUID{0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
	URL  = UUID{0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
	OID  = UUID{0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
	X500 = UUID{0x6b, 0xa7, 0xb8, 0x14, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8}
)

Namespaces

Functions

This section is empty.

Types

type UUID

type UUID [16]byte

A UUID is a universally unique identifier: a 128-bit value.

func New3

func New3(namespace UUID, id []byte) UUID

New3 creates a UUID (version 3) based on the MD5 hash of the namespace and ID given.

func New4

func New4(r io.Reader) (UUID, error)

New4 generates a new UUID (version 4) using a provided source of random bytes. If r is nil, crypto/rand.Reader is used.

func New5

func New5(namespace UUID, id []byte) UUID

New5 creates a UUID (version 5) based on the SHA-1 hash of the namespace and ID given.

func Parse

func Parse(s string) (UUID, error)

Parse parses a hex-encoded UUID string (that may contain dashes) into a UUID.

func (UUID) AppendHex

func (u UUID) AppendHex(b []byte) []byte

AppendHex appends the dash-separated hex representation of u to b and returns the extended buffer.

func (UUID) IsZero

func (u UUID) IsZero() bool

IsZero reports whether this is the zero UUID.

func (UUID) String

func (u UUID) String() string

String returns the dash-separated hex representation of u as a string.

func (UUID) Version

func (u UUID) Version() int

Version returns u's version or zero if this is not the RFC-specified UUID variant.

Jump to

Keyboard shortcuts

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