snowflake

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LongEpoch int64 = 1536297193013

Functions

func BytesToInt64 added in v1.1.5

func BytesToInt64(b []byte) int64

func GetTimeMilliSecond added in v1.1.5

func GetTimeMilliSecond() int64

得到毫秒时间戳

Types

type SnowFlake

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

func NewShowFlake

func NewShowFlake(epoch, workerId, dataCenterId int64) (*SnowFlake, error)

创建一个 snowid 生成器 epoch: 开始产生ID的纪元时间戳 workerId: 工作ID标识 dataCenterId: 数据ID标识

func (*SnowFlake) NextId

func (s *SnowFlake) NextId() (int64, error)

得到下一个ID

type SnowId

type SnowId struct {
	RawId        int64
	Sequence     int64
	WorkerId     int64
	DataCenterId int64
	Timestamp    int64
}

func SnowRaw

func SnowRaw(raw int64) *SnowId

Jump to

Keyboard shortcuts

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