uuid

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const V4UUIDRegex = "\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}\\b"

V4UUIDRegex is a simple string regex that will match valid v4 UUIDs

Variables

This section is empty.

Functions

This section is empty.

Types

type UUID

type UUID [16]byte

UUID Represents a UUID

func GetUUIDFromByteSlice

func GetUUIDFromByteSlice(slice []byte) (*UUID, error)

GetUUIDFromByteSlice takes a slice of bytes and converts it to a UUID If the slice is not 16 bytes long it will return an error @TODO add version checking

func GetUUIDFromString

func GetUUIDFromString(strUUID string) (*UUID, error)

GetUUIDFromString takes a string representing a UUID and converts it to a UUID type Returns an error if the string does not match a UUID

func New

func New() (result *UUID)

NewV4UUID returns a randomized version 4 UUID

func NewNilUUID

func NewNilUUID() *UUID

NewNilUUID returns a nil UUID (All bits set to zero)

func (*UUID) Equals

func (u *UUID) Equals(comp *UUID) bool

func (*UUID) GetVersion

func (u *UUID) GetVersion() string

GetVersion returns the version of the UUID based on the 13th character (1st char of 7th byte) of the UUID

func (*UUID) String

func (u *UUID) String() string

ToString converts the UUID into its string representation

Jump to

Keyboard shortcuts

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