Documentation ¶
Overview ¶
Package uuid provides tools for generating and validating various RFC 4122 compliant UUIDs
https://tools.ietf.org/html/rfc4122
Default V4 UUID generation is benchmarked at ~500ns per generation (2.6 GHz Core i7 (I7-8850H)) and does not benefit from any buffering/pre-generation.
Index ¶
- func Base32Encoder(asBytes Bytes16) string
- func Base64Encoder(asBytes Bytes16) string
- func StandardEncoder(asBytes Bytes16) string
- func V4() string
- func V4Custom(gen Generate16Byte, e EncodeFrom16Byte) string
- func ValidFormat(uuid string) bool
- func ValidV4(uuid string) bool
- type Bytes16
- type EncodeFrom16Byte
- type Generate16Byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base32Encoder ¶
Base32Encoder encodes the supplied 128 bit number as a base32 string
func Base64Encoder ¶
Base64Encoder encodes the supplied 128 bit number as a base32 string
func StandardEncoder ¶
StandardEncoder encodes the supplied 128 bit number as a standard dash separated UUID
func V4 ¶
func V4() string
V4 returns a valid V4 UUID using the default random number generator with no uniqueness checks
func V4Custom ¶
func V4Custom(gen Generate16Byte, e EncodeFrom16Byte) string
V4Custom returns a valid V4 UUID with a custom random number generator and EncodeFrom16Byte
func ValidFormat ¶
ValidFormat returns true if the supplied string is in accordance with the ABNF defined in Section 3 of RFC 4122
Types ¶
type Bytes16 ¶
type Bytes16 [16]byte
Bytes16 is a 128-bit number represented as 16 bytes
func GenerateCryptoRand ¶
func GenerateCryptoRand() Bytes16
GenerateCryptoRand creates a random 128 bit number using crypto/rand.Reader as a source
type EncodeFrom16Byte ¶
EncodeFrom16Byte takes a 16 byte/128-bit representation of a UUID and encodes it as a string
type Generate16Byte ¶
type Generate16Byte func() Bytes16
Generate16Byte is a type of function able to create unsigned 128-bit numbers represented as a sequence of 16 bytes.