Documentation ¶
Overview ¶
Package uuid provides helpful functions for the work with UUIDs. Most important are the functions for the generation of UUIDs in the different versions 1, 3, 4, and 5. More versions are planned. It also can analyse and format those unique identifiers.
Index ¶
- type UUID
- func NamespaceDNS() UUID
- func NamespaceOID() UUID
- func NamespaceURL() UUID
- func NamespaceX500() UUID
- func New() UUID
- func NewV1() (UUID, error)
- func NewV3(ns UUID, name []byte) (UUID, error)
- func NewV4() (UUID, error)
- func NewV5(ns UUID, name []byte) (UUID, error)
- func Parse(source string) (UUID, error)
- type Variant
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UUID ¶
type UUID [16]byte
UUID represents a universal identifier with 16 bytes. See http://en.wikipedia.org/wiki/Universally_unique_identifier.
func NamespaceDNS ¶
func NamespaceDNS() UUID
NamespaceDNS returns the DNS namespace UUID for a v3 or a v5.
func NamespaceOID ¶
func NamespaceOID() UUID
NamespaceOID returns the OID namespace UUID for a v3 or a v5.
func NamespaceURL ¶
func NamespaceURL() UUID
NamespaceURL returns the URL namespace UUID for a v3 or a v5.
func NamespaceX500 ¶
func NamespaceX500() UUID
NamespaceX500 returns the X.500 namespace UUID for a v3 or a v5.
func Parse ¶ added in v0.1.1
Parse creates a UUID based on the given hex string which has to have one of the following formats:
- xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx - {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The net data always has to have the length of 32 bytes.
func (UUID) ShortString ¶
ShortString returns a hexadecimal string representation without separators.