utils

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

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

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

func NewDelayedExecutor

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

func (*DelayedExecutor) Cancel

func (d *DelayedExecutor) Cancel(key string)

func (*DelayedExecutor) Do

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

type DelayedState

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

type Throttle

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

func NewThrottle

func NewThrottle(limit time.Duration) *Throttle

func (*Throttle) Do

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