uuids

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var V4OnlyRegex = regexp.MustCompile(`^` + V4Regex.String() + `$`)

V4OnlyRegex matches a string containing only a valid v4 UUID

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

V4Regex matches a string containing a valid v4 UUID

Functions

func IsV4

func IsV4(s string) bool

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

func SetGenerator

func SetGenerator(generator Generator)

SetGenerator sets the generator used by UUID4()

Types

type Generator

type Generator interface {
	Next() UUID
}

Generator is something that can generate a UUID

var DefaultGenerator Generator = defaultGenerator{}

DefaultGenerator is the default generator for calls to NewUUID

func NewSeededGenerator

func NewSeededGenerator(seed int64) Generator

NewSeededGenerator creates a new seeded UUID4 generator from the given seed

type UUID

type UUID string

UUID is a 36 character UUID

func New

func New() UUID

New returns a new v4 UUID

Jump to

Keyboard shortcuts

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