Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // NIL is defined in RFC 4122 section 4.1.7. // The nil UUID is special form of UUID that is specified to have all 128 bits set to zero. NIL = &UUID{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } // NameSpaceDNS assume name to be a fully-qualified domain name. // Declared in RFC 4122 Appendix C. NameSpaceDNS = &UUID{ 0x6b, 0xa7, 0xb8, 0x10, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8, } // NameSpaceURL assume name to be a URL. // Declared in RFC 4122 Appendix C. NameSpaceURL = &UUID{ 0x6b, 0xa7, 0xb8, 0x11, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8, } // NameSpaceOID assume name to be an ISO OID. // Declared in RFC 4122 Appendix C. NameSpaceOID = &UUID{ 0x6b, 0xa7, 0xb8, 0x12, 0x9d, 0xad, 0x11, 0xd1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8, } // NameSpaceX500 assume name to be a X.500 DN (in DER or a text output format). // Declared in RFC 4122 Appendix C. NameSpaceX500 = &UUID{ 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 [16]byte
The UUID represents Universally Unique IDentifier (which is 128 bit long).
func NewNamespaceUUID ¶
NewNamespaceUUID creates a namespace UUID by using the namespace name in the NIL name space. This is a different approach as the 4 "standard" namespace UUIDs which are timebased UUIDs (V1).
Example ¶
fmt.Printf("UUID(test): %s\n", NewNamespaceUUID("test")) fmt.Printf("UUID(myNameSpace): %s\n", NewNamespaceUUID("myNameSpace"))
Output: UUID(test): e8b764da-5fe5-51ed-8af8-c5c6eca28d7a UUID(myNameSpace): 40e41e4d-01d6-5e36-8c6b-93edcdf1442d
func NewV1 ¶
func NewV1() *UUID
NewV1 creates a new UUID with variant 1 as described in RFC 4122. Variant 1 is based on hosts MAC address and actual timestamp (as count of 100-nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar).
func NewV3 ¶
NewV3 creates a new UUID with variant 3 as described in RFC 4122. Variant 3 based namespace-uuid and name and MD-5 hash calculation.
func NewV4 ¶
func NewV4() *UUID
NewV4 creates a new UUID with variant 4 as described in RFC 4122. Variant 4 based on pure random bytes.
func NewV5 ¶
NewV5 creates a new UUID with variant 5 as described in RFC 4122. Variant 5 based namespace-uuid and name and SHA-1 hash calculation.