idgen

package
v1.7.13 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT, Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrderedID

func NewOrderedID() uint64

单机顺序id

func NewOrderedIDGenerator added in v1.7.13

func NewOrderedIDGenerator(initial uint64) func() uint64

func NewRandomIDGenerator added in v1.7.13

func NewRandomIDGenerator(randSource *rand.Rand) *randomIDGenerator

Types

type ID added in v1.7.13

type ID [16]byte

func NewRandomID

func NewRandomID() ID

func UniqueID

func UniqueID() ID

func (ID) IsValid added in v1.7.13

func (t ID) IsValid() bool

IsValid checks whether the trace TraceID is valid. A valid trace ID does not consist of zeros only.

func (ID) MarshalJSON added in v1.7.13

func (t ID) MarshalJSON() ([]byte, error)

MarshalJSON implements a custom marshal function to encode TraceID as a hex string.

func (ID) String added in v1.7.13

func (t ID) String() string

String returns the hex string representation form of a TraceID.

func (ID) UnmarshalJSON added in v1.7.13

func (t ID) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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