MCPcopy
hub / github.com/google/uuid / URN

Method URN

uuid.go:252–257  ·  view source on GitHub ↗

URN returns the RFC 2141 URN form of uuid, urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.

()

Source from the content-addressed store, hash-verified

250// URN returns the RFC 2141 URN form of uuid,
251// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
252func (uuid UUID) URN() string {
253 var buf [36 + 9]byte
254 copy(buf[:], "urn:uuid:")
255 encodeHex(buf[9:], uuid)
256 return string(buf[:])
257}
258
259func encodeHex(dst []byte, uuid UUID) {
260 hex.Encode(dst, uuid[:4])

Callers 2

TestCodingFunction · 0.95
BenchmarkUUID_URNFunction · 0.80

Calls 1

encodeHexFunction · 0.85

Tested by 2

TestCodingFunction · 0.76
BenchmarkUUID_URNFunction · 0.64