idgenerator

package
v0.0.2-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package idgenerator provides distributed unique ID generation using the Snowflake algorithm. It supports multiple worker instances with configurable worker IDs to ensure globally unique 64-bit integers across distributed systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIdGenerator

func NewIdGenerator(workerID uint16) func() int64

NewIdGenerator creates a new ID generator instance with the specified worker ID. Each worker should have a unique ID to ensure global uniqueness across multiple instances. Returns a function that generates new unique IDs when called.

func NextId

func NextId() int64

NextId generates the next unique ID using the global ID generator. It returns a 64-bit integer that is globally unique across distributed systems.

Types

This section is empty.

Jump to

Keyboard shortcuts

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