id

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64

func Int64() int64

Int64 generates a snowflake ID as int64 from default node

func String

func String() string

String generates a snowflake ID as base58 string from default node

Types

type Node

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

Node represents a snowflake ID generator node

func MustNewNode

func MustNewNode(nodeID int64) *Node

MustNewNode creates a snowflake ID generator node. Panics if nodeID is outside the valid range [0, 1023]

func NewNode

func NewNode(nodeID int64) (*Node, error)

NewNode creates a snowflake ID generator node. nodeID must be in the range [0, 1023] as per snowflake specifications

func (*Node) Int64

func (n *Node) Int64() int64

Int64 generates a snowflake ID as int64 from this node

func (*Node) String

func (n *Node) String() string

String generates a snowflake ID as base58 string from this node

Jump to

Keyboard shortcuts

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