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

Method URN

uuid.go:280–285  ·  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

278// URN returns the RFC 2141 URN form of uuid,
279// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
280func (uuid UUID) URN() string {
281 var buf [36 + 9]byte
282 copy(buf[:], "urn:uuid:")
283 encodeHex(buf[9:], uuid)
284 return string(buf[:])
285}
286
287func encodeHex(dst []byte, uuid UUID) {
288 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