idpkg

package
v0.3.31 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultEpoch = time.Date(2020, 10, 1, 0, 0, 0, 0, time.Local)
)

Functions

func GenNodeID added in v0.3.23

func GenNodeID() (uint16, error)

func IPV4ToNodeID added in v0.3.23

func IPV4ToNodeID(ip string) (uint16, error)

func NextID added in v0.2.18

func NextID() (uint64, error)

NextID ... 为了帮助保证唯一性 - 确保您的系统保持准确的系统时间 - 确保您永远不会有多个节点以相同的节点 ID 运行

func SetNode

func SetNode(node Snowflake)

Types

type Snowflake added in v0.3.15

type Snowflake interface {
	NextID() (uint64, error)
}
var (
	// Node 生成ID的节点
	// 为了帮助保证唯一性
	// - 确保您的系统保持准确的系统时间
	// - 确保您永远不会有多个节点以相同的节点 ID 运行
	Node Snowflake
)

func NewBwmarrinSnowflake added in v0.3.15

func NewBwmarrinSnowflake(nodeid int64) (Snowflake, error)

func NewSonySonyflake added in v0.3.15

func NewSonySonyflake(nodeid int64) (Snowflake, error)

Jump to

Keyboard shortcuts

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