nonce

package
v1.64.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MillisecondNonce

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

MillisecondNonce generates nonce values based on the current time in milliseconds with microsecond precision.

func NewMillisecondNonce

func NewMillisecondNonce(now time.Time) *MillisecondNonce

func (*MillisecondNonce) GetInt64

func (ng *MillisecondNonce) GetInt64() int64

GetInt64 generates a unique nonce based on the current time in milliseconds * 1000. If multiple calls occur within the same millisecond, atomic increment ensures uniqueness. The unit is microsecond (1 second = 1,000,000 microseconds).

func (*MillisecondNonce) GetString

func (ng *MillisecondNonce) GetString() string

GetString generates a unique nonce based on the current time in milliseconds * 1000. If multiple calls occur within the same millisecond, atomic increment ensures uniqueness.

type SecondNonce

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

SecondNonce generates nonce values based on the current time in seconds with microsecond precision.

func NewSecondNonce

func NewSecondNonce(now time.Time) *SecondNonce

func (*SecondNonce) GetInt64

func (ng *SecondNonce) GetInt64() int64

GetInt64 generates a unique nonce based on the current time in seconds * 1000. If multiple calls occur within the same second, atomic increment ensures uniqueness. The unit is millisecond (1 second = 1,000 milliseconds).

func (*SecondNonce) GetString

func (ng *SecondNonce) GetString() string

GetString generates a unique nonce based on the current time in seconds * 1000.

Jump to

Keyboard shortcuts

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