uuid
CUE v0.18.0
Package uuid defines functionality for creating UUIDs as defined in RFC 4122.
Currently only Version 5 (SHA1) and Version 3 (MD5) are supported.
Constants
ns
ns: {
DNS: "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
URL: "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
OID: "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
X500: "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
Nil: "00000000-0000-0000-0000-000000000000"
}Predefined namespaces
variants
variants: Invalid: 0
variants: RFC4122: 1
variants: Reserved: 2
variants: Microsoft: 3
variants: Future: 4Invalid UUID
The variant specified in RFC4122
Reserved, NCS backward compatibility.
Reserved, Microsoft Corporation backward compatibility.
Reserved for future definition.
Functions
FromInt
FromInt: func(i: int) -> stringFromInt creates a UUID from an integer.
DNS: uuid.FromInt(0x6ba7b810_9dad_11d1_80b4_00c04fd430c8)MD5
MD5: func(space: string, data: bytes | string) -> stringMD5 generates a version 3 UUID based on the supplied name space and data. Use SHA1 instead if you can.
Parse
Parse: func(s: string) -> stringParse decodes s into a UUID or returns an error. Both the standard UUID forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
SHA1
SHA1: func(space: string, data: bytes | string) -> stringSHA1 generates a version 5 UUID based on the supplied name space and data.
ToInt
ToInt: func(x: string) -> intToInt represents a UUID string as a 128-bit value.
URN
URN: func(x: string) -> stringURN reports the canonical URN of a UUID.
Valid validator
validator form
validator(string)call form
func(s: string) -> _Valid ensures that s is a valid UUID which would be accepted by Parse.
Variant
Variant: func(x: string) -> intVariant reports the UUID variant.
Version
Version: func(x: string) -> intVersion reports the UUID version.