uid

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Offset is used to create new apoch from current time.
	Offset = 1555770000
)

Variables

View Source
var (
	// Next is the next identifier. It is time in seconds
	// to avoid collisions of ids between process restarts.
	Next = uint32(
		time.Date(2070, 1, 1, 0, 0, 0, 0, time.UTC).Sub(time.Now()).Seconds(),
	)
)

Functions

func NewApoch

func NewApoch() uint32

NewApoch creates an appoch to generate unique id.

func NewUnique

func NewUnique() uint32

NewUnique return unique value to use generating unique id.

func Time

func Time(id []byte) int64

Time returns time portion of ID.

Types

type LID

type LID uint64

LID represents a process-wide unique ID.

func NewLID

func NewLID() LID

NewLID generates a new, process-wide unique ID.

Jump to

Keyboard shortcuts

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