uid

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: AGPL-3.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

Types

type LID

type LID uint64

LID represents a process-wide unique ID.

func NewLID

func NewLID() LID

NewID 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