randomuuid

package
v0.0.0-...-bb1a4e7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HexUuidSize = RawUuidSize * 2
View Source
const RawUuidSize = 16

RawUuidSize of a UUID in bytes.

Variables

This section is empty.

Functions

func GenerateSnowFlakeId

func GenerateSnowFlakeId() [8]byte

func GenerateUUIDFromEntropy

func GenerateUUIDFromEntropy() string

GenerateBytesUUID returns a UUID based on RFC 4122 returning the generated bytes

func RandomStr

func RandomStr(length int) []byte

func ReadAtLeast

func ReadAtLeast(r io.Reader, buf [RawUuidSize]byte, min int) (n int, err error)

func StringWithCharset

func StringWithCharset(length int, charset string) []byte

BenchmarkGenerateUUID/random-str-charset-4 2000000 888 ns/op 1.13 MB/s 64 B/op 2 allocs/op

Types

type UniqueIdHex

type UniqueIdHex [32]byte

func GenerateIDString

func GenerateIDString() UniqueIdHex

GenerateIDString returns a UUID based on RFC 4122 returning the generated bytes

func (UniqueIdHex) Bytes

func (uid UniqueIdHex) Bytes() [32]byte

func (UniqueIdHex) Slice

func (uid UniqueIdHex) Slice() []byte

func (UniqueIdHex) String

func (uid UniqueIdHex) String() string

func (UniqueIdHex) UnsafeString

func (uid UniqueIdHex) UnsafeString() string

type UniqueIdRaw

type UniqueIdRaw [16]byte

func GenerateIDRaw

func GenerateIDRaw() UniqueIdRaw

GenerateIDRaw returns a UUID based on RFC 4122 returning the generated bytes

func (UniqueIdRaw) Bytes

func (uid UniqueIdRaw) Bytes() [16]byte

func (UniqueIdRaw) Slice

func (uid UniqueIdRaw) Slice() []byte

func (UniqueIdRaw) String

func (uid UniqueIdRaw) String() string

Jump to

Keyboard shortcuts

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