snowflake

package
v0.0.0-...-01d4da0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MulanPSL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDeviceID

func GetDeviceID(sid int64) (datacenterid, workerid int64)

获取数据中心ID和机器ID

func GetGenTime

func GetGenTime(sid int64) (t string)

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

func GetGenTimestamp

func GetGenTimestamp(sid int64) (timestamp int64)

获取创建ID时的时间戳

func GetTimestamp

func GetTimestamp(sid int64) (timestamp int64)

获取时间戳

func GetTimestampStatus

func GetTimestampStatus() (state float64)

获取时间戳已使用的占比:范围(0.0 - 1.0)

Types

type Snowflake

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

func NewSnowflake

func NewSnowflake(datacenterid, workerid int64) (*Snowflake, error)

func (*Snowflake) NextVal

func (s *Snowflake) NextVal() int64

Jump to

Keyboard shortcuts

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