uuid

package
v0.0.0-...-04f2983 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2021 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 27 modules, 26 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package uuid can be used to generate 128 bit UUIDs compatible with rfc4122. Currently, only version 4 UUIDs, UUIDs generated from random data, can be created. The package includes functions for generating UUIDs and for converting them to and from strings.

Index

Constants

View Source
const UUIDRegex = "[a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?4[a-fA-F0-9]{3}-?[8|9|aA|bB][a-fA-F0-9]{3}-?[a-fA-F0-9]{12}"

UUIDRegex defines a pattern for validating UUIDs

Variables

View Source
var (
	// ErrUUIDInvalid indicates that a UIID is invalid.  Currently,
	// returned by uuid.Parse if the string passed to this function
	// does not contain a valid UUID.
	ErrUUIDInvalid = errors.New("invalid uuid")
)

Functions

This section is empty.

Types

type UUID

type UUID [16]byte

UUID represents a single 128 bit UUID as an array of 16 bytes.

func Generate

func Generate() UUID

Generate generates a new v4 UUID, i.e., a random UUID.

func Parse

func Parse(s string) (UUID, error)

Parse returns the binary encoding of the UUID passed in the s parameter. The error ErrUUIDInvalid will be returned if s does not represent a valid UUID.

func (UUID) String

func (u UUID) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL