utils

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareSlices

func CompareSlices(a, b []any) bool

func CompareStringSlices

func CompareStringSlices(a, b []string) bool

func Ptr

func Ptr[T any](v T) *T

Types

type DelayedExecutor added in v0.4.15

type DelayedExecutor struct {
	States      sync.Map
	Delay       time.Duration
	MaxInterval time.Duration
}

func NewDelayedExecutor added in v0.4.15

func NewDelayedExecutor(delay, maxInterval time.Duration) *DelayedExecutor

func (*DelayedExecutor) Cancel added in v0.4.15

func (d *DelayedExecutor) Cancel(key string)

func (*DelayedExecutor) Do added in v0.4.15

func (d *DelayedExecutor) Do(key string, execFunc func())

type DelayedState added in v0.4.15

type DelayedState struct {
	StartTime time.Duration
	Timer     *time.Timer
	ExecFunc  func()
}

type Throttle added in v0.4.15

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

func NewThrottle added in v0.4.15

func NewThrottle(limit time.Duration) *Throttle

func (*Throttle) Do added in v0.4.15

func (t *Throttle) Do(f func())

Directories

Path Synopsis
methods in this package automatically include a context with a timeout, in order to solve the problem of hanging requests and to avoid goroutine leaks
methods in this package automatically include a context with a timeout, in order to solve the problem of hanging requests and to avoid goroutine leaks

Jump to

Keyboard shortcuts

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