The `google/uuid` package
The google/uuid
package
The google/uuid
package in Go is a library for generating and working with universally unique identifiers (UUIDs). It provides a wide range of functions for creating, parsing, and comparing UUIDs.
Function | Description |
---|---|
uuid.New() | Generates a new random UUID (UUID v4). |
uuid.NewString() | Returns a new random UUID as a string (UUID v4). |
uuid.Must() | A convenience function that panics if UUID creation fails. |
uuid.NewRandom() | Generates a random UUID (UUID v4) from a secure random source. |
uuid.Parse() | Parses a UUID string into a UUID object. |
uuid.FromString() | Converts a string representation of a UUID into a UUID object (deprecated). |
uuid.Equal() | Compares two UUIDs for equality. |
uuid.NewUUID() | Generates a UUID based on MAC address and timestamp (UUID v1). |
uuid.NewMD5() | Creates a UUID based on a namespace and a name using MD5 hashing (UUID v3). |
uuid.NewSHA1() | Creates a UUID based on a namespace and a name using SHA1 hashing (UUID v5). |
This table summarizes the key functions and their descriptions for the google/uuid
package.