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