uuids

package
v1.59.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 6 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Regex = regexp.MustCompile(`[0-9a-f]{8}-[0-9a-f]{4}-([1-7])[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}`)
)

Functions

func Is added in v1.57.1

func Is(s string) bool

Is returns whether the given string contains only a valid v4 UUID

func SetGenerator

func SetGenerator(generator Generator)

SetGenerator sets the generator used by UUID4()

func Version added in v1.57.1

func Version(s string) int

Types

type Generator

type Generator interface {
	NextV4() UUID
	NextV7() UUID
}

Generator is something that can generate UUIDs

var DefaultGenerator Generator = defaultGenerator{}

DefaultGenerator is the default generator for calls to NewUUID

func NewSeededGenerator

func NewSeededGenerator(seed int64, now dates.NowFunc) Generator

NewSeededGenerator creates a new UUID generator that uses the given seed for the random component and the time source for the time component (only applies to v7)

type UUID

type UUID string

UUID is a UUID encoded as a 36 character string using lowercase hex characters

func NewV4 added in v1.57.0

func NewV4() UUID

NewV4 returns a new v4 UUID

func NewV7 added in v1.57.0

func NewV7() UUID

NewV4 returns a new v7 UUID

Jump to

Keyboard shortcuts

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