idgen

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 时间戳使用32位存放,为了增加上限采用存储时减去此值,此值为2020-01-01 00:00:00时间戳
	CEpoch        = 1577808000
	CWorkerIDBits = 5  // Num of WorkerID Bits
	CSequenceBits = 16 // Num of Sequence Bits
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IDWorker

type IDWorker struct {
	// contains filtered or unexported fields
}

IDWorker Struct

func NewIDWorker

func NewIDWorker(workerID int64) (*IDWorker, error)

NewIDWorker Func: Generate NewIDWorker with Given workerid

func (*IDWorker) NextID

func (iw *IDWorker) NextID() (ts int64, err error)

NextID Generate next ID

Jump to

Keyboard shortcuts

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