package uuid
import "cuelang.org/go/pkg/uuid"
Package uuid defines functionality for creating UUIDs as defined in RFC 4122.
Currently only Version 5 (SHA1) and Version 3 (MD5) are supported.
Index ¶
- func FromInt(i *big.Int) (string, error)
- func MD5(space string, data []byte) (string, error)
- func Parse(s string) (string, error)
- func SHA1(space string, data []byte) (string, error)
- func ToInt(x string) *big.Int
- func ToString(x string) string
- func URN(x string) (string, error)
- func Valid(s string) error
- func Variant(x string) (int, error)
- func Version(x string) (int, error)
Functions ¶
func FromInt ¶
FromInt creates a UUID from an integer.
DNS: uuid.FromInt(0x6ba7b810_9dad_11d1_80b4_00c04fd430c8)
func MD5 ¶
MD5 generates a version 3 UUID based on the supplied name space and data. Use SHA1 instead if you can.
func Parse ¶
Parse 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.
func SHA1 ¶
SHA1 generates a version 5 UUID based on the supplied name space and data.
func ToInt ¶
ToInt represents a UUID string as a 128-bit value.
func ToString ¶
String represents a 128-bit UUID value as a string.
func URN ¶
URN reports the canonical URN of a UUID.
func Valid ¶
Valid ensures that s is a valid UUID which would be accepted by Parse.
func Variant ¶
Variant reports the UUID variant.
func Version ¶
Version reports the UUID version.
Source Files ¶
pkg.go uuid.go
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 8 hours ago –
Tools for package owners.