...

Package uuid

import "github.com/docker/distribution/uuid"
Overview
Index

Overview ▾

Package uuid provides simple UUID generation. Only version 4 style UUIDs can be generated.

Please see http://tools.ietf.org/html/rfc4122 for details on UUIDs.

Constants

const (
    // Bits is the number of bits in a UUID
    Bits = 128

    // Size is the number of bytes in a UUID
    Size = Bits / 8
)

Variables

var (
    // ErrUUIDInvalid indicates a parsed string is not a valid uuid.
    ErrUUIDInvalid = fmt.Errorf("invalid uuid")

    // Loggerf can be used to override the default logging destination. Such
    // log messages in this library should be logged at warning or higher.
    Loggerf = func(format string, args ...interface{}) {}
)

type UUID

UUID represents a UUID value. UUIDs can be compared and set to other values and accessed by byte.

type UUID [Size]byte

func Generate

func Generate() (u UUID)

Generate creates a new, version 4 uuid.

func Parse

func Parse(s string) (u UUID, err error)

Parse attempts to extract a uuid from the string or returns an error.

func (UUID) String

func (u UUID) String() string