snowflake

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID() uint64

GenerateID 生成 id

func ParseID

func ParseID(id uint64) (t time.Time, machineID int, sn int64)

ParseID 解析 id

func SetMachineID

func SetMachineID(machineID int)

SetMachineID 设置 machine ID 如果未设置 MachineID 的时候,每次 GenerateID 就会随机产生一个机器 ID,有一定几率发生碰撞。

Types

type SnowFlake

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

Jump to

Keyboard shortcuts

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