snowflake

package
v0.0.0-...-8beb243 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snowflake

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

Snowflake is a struct that holds the state of the snowflake generator.

func New

func New(epochOffset int64, workerID int64) *Snowflake

New returns a new Snowflake generator.

If epochOffset < 0 then it is set to 0. If workerID < 0 or workerID > 1023 then it is set to 0.

func (*Snowflake) Next

func (s *Snowflake) Next() uint64

Next returns the next snowflake ID.

Jump to

Keyboard shortcuts

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