snowflake

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IdWorker

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

func NewIdWorker

func NewIdWorker(workerId, datacenterId, twepoch int64) (*IdWorker, error)

func (*IdWorker) GetDeviceID added in v0.0.4

func (id *IdWorker) GetDeviceID(sid int64) (workerId, datacenterId int64)

获取数据中心ID和机器ID

func (*IdWorker) GetFormatedGenTime added in v0.0.4

func (id *IdWorker) GetFormatedGenTime(sid int64) (t string)

获取创建ID时的时间字符串(精度:秒)

func (*IdWorker) GetGenTimestamp added in v0.0.4

func (id *IdWorker) GetGenTimestamp(sid int64) (timestamp int64)

获取创建ID时的时间戳

func (*IdWorker) NextId

func (id *IdWorker) NextId() (int64, error)

func (*IdWorker) NextIds

func (id *IdWorker) NextIds(num int) ([]int64, error)

Jump to

Keyboard shortcuts

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