A new package supporting all UUID versions from 1 trough 8 has been released at FossoresLP/uuid and supersedes this package.
This package contains a minimal implementation of UUIDv4 in Go.
Consider using either Google's implementation or this one by Gofrs if you need additional features.
This package can only generate version 4 UUIDs as defined in RFC 4122
Create a new UUID: uuid.New() (UUID, error)
Convert an UUID to a string: UUID.String() string
Do both in one step: uuid.NewString() (string, error)
Convert a string to an UUID: uuid.Parse(string) (UUID, error)
Convert a byte slice to an UUID: uuid.ParseBytes([]byte) (UUID, error)
Check if UUID contains only zeros: UUID.IsEmpty() bool
Both encoding.Text(Un)Marshaler
and encoding.Binary(Un)Marshaler
are supported to ensure compatibility with databases and data exchange formats.