idgen

package
Version: v0.0.0-...-13ef31d Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 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

	CWorkerIDShift  = 16
	CTimeStampShift = 21
)

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

Source Files

Jump to

Keyboard shortcuts

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