URN returns the RFC 2141 URN form of uuid, urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
()
| 250 | // URN returns the RFC 2141 URN form of uuid, |
| 251 | // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid. |
| 252 | func (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 | |
| 259 | func encodeHex(dst []byte, uuid UUID) { |
| 260 | hex.Encode(dst, uuid[:4]) |