idgenerator

package
v0.0.0-...-a9e2aaa Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDGenerator

type IDGenerator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

IDGenerator contains the structure of the id generator. IDs are comprised of a similar structure to instagram where 41 bits contain the timestamp then a further 23 bits for a shard and sequence.

func NewIDGenerator

func NewIDGenerator(initialEpoch int64, shardID int64) *IDGenerator

NewIDGenerator returns an IDGenerator.

func (*IDGenerator) GenerateID

func (id *IDGenerator) GenerateID() int64

GenerateID returns a new id that is int64.

Jump to

Keyboard shortcuts

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