uuid

package
v12.20.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

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

func GenUUID

func GenUUID() string

GenUUID generates v4 UUID (Universally Unique Identifier)

Example
fmt.Printf("UUID: %s\n", GenUUID())
Output:

func GenUUID4

func GenUUID4() string

GenUUID4 generates random generated UUID

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

func GenUUID5

func GenUUID5(ns []byte, name string) string

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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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