uuid

package
v13.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package uuid contains methods for generating version 4 and 5 UUID's

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	NsDNS  = []byte{107, 167, 184, 16, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NsURL  = []byte{107, 167, 184, 17, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NsOID  = []byte{107, 167, 184, 18, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NsX500 = []byte{107, 167, 184, 20, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
)

Predefined namespace UUID's

Functions

This section is empty.

Types

type UUID

type UUID []byte

UUID contains UUID data

func UUID4

func UUID4() UUID

UUID4 generates random generated UUID v4

Example
fmt.Printf("UUID v4: %s\n", UUID4().String())
Output:

func UUID5

func UUID5(ns []byte, name string) UUID

UUID5 generates UUID v5 based on SHA-1 hash of namespace UUID and name

Example
fmt.Printf("UUID v5: %s\n", UUID5(NsURL, "http://www.domain.com").String())
Output:

func UUID7

func UUID7() UUID

UUID7 generates UUID v7 based on timestamp

Example
fmt.Printf("UUID v7: %s\n", UUID7().String())
Output:

func (UUID) IsZero

func (u UUID) IsZero() bool

IsZero returns true if UUID is empty

func (UUID) String

func (u UUID) String() string

String returns string representation of UUID

Jump to

Keyboard shortcuts

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