README ¶
Pure Go UUID implementation
This package provides immutable UUID structs and the functions NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 and 5 UUIDs as specified in RFC 4122.
Installation
Use the go
tool:
$ go get github.com/nu7hatch/gouuid
Usage
See documentation and examples for more information.
Copyright
Copyright (C) 2011 by Krzysztof Kowalik chris@nu7hat.ch. See COPYING file for details.
Documentation ¶
Overview ¶
This package provides immutable UUID structs and the functions NewV3, NewV4, NewV5 and Parse() for generating versions 3, 4 and 5 UUIDs as specified in RFC 4122.
Copyright (C) 2011 by Krzysztof Kowalik <chris@nu7hat.ch>
Index ¶
Examples ¶
Constants ¶
const ( ReservedNCS byte = 0x80 ReservedRFC4122 byte = 0x40 ReservedMicrosoft byte = 0x20 ReservedFuture byte = 0x00 )
The UUID reserved variants.
Variables ¶
var (
NamespaceDNS, _ = ParseHex("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
NamespaceURL, _ = ParseHex("6ba7b811-9dad-11d1-80b4-00c04fd430c8")
NamespaceOID, _ = ParseHex("6ba7b812-9dad-11d1-80b4-00c04fd430c8")
NamespaceX500, _ = ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8")
)
The following standard UUIDs are for use with NewV3() or NewV5().
Functions ¶
This section is empty.
Types ¶
type UUID ¶
type UUID [16]byte
A UUID representation copmliant with specification in RFC 4122 document.
func NewV5 ¶
Generate a UUID based on the SHA-1 hash of a namespace identifier and a name.
Example ¶
Output:
func ParseHex ¶
ParseHex creates a UUID object from given hex string representation. Function accepts UUID string in following formats:
uuid.ParseHex("6ba7b814-9dad-11d1-80b4-00c04fd430c8") uuid.ParseHex("{6ba7b814-9dad-11d1-80b4-00c04fd430c8}") uuid.ParseHex("urn:uuid:6ba7b814-9dad-11d1-80b4-00c04fd430c8")
Example ¶
Output: