Help us shape the future of Go! Take the 2026 Go Developer Survey

idutil

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ObjectId

func ObjectId() string

ObjectId 生成 MongoDB 风格的 ObjectId

func RandomUUID

func RandomUUID() string

RandomUUID 生成带 "-" 的 UUID (版本4)

func SimpleUUID

func SimpleUUID() string

SimpleUUID 生成不带 "-" 的 UUID

Types

type Snowflake

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

Snowflake 结构体

func NewSnowflake

func NewSnowflake(nodeID int64) *Snowflake

NewSnowflake 创建一个新的 Snowflake 生成器

func (*Snowflake) NextId

func (s *Snowflake) NextId() int64

NextId 生成下一个 Snowflake ID

func (*Snowflake) NextIdStr

func (s *Snowflake) NextIdStr() string

NextIdStr 生成下一个 Snowflake ID 字符串

Jump to

Keyboard shortcuts

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