limit

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiLimiter

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

ApiLimiter Api接口调用限速器 合并多个api请求为批量处理请求,需要接口方支持批量处理 例: 300毫秒内

func New

func New(interval int64) *ApiLimiter

func (*ApiLimiter) Action

func (l *ApiLimiter) Action(data interface{}) chan any

Action desc: 添加要处理的数据

func (*ApiLimiter) Close

func (l *ApiLimiter) Close()

func (*ApiLimiter) Run

func (l *ApiLimiter) Run(fn func(datas []any) []any)

主程序运行

type LimiterOption

type LimiterOption struct {
	Data     any      // Api请求数据
	RespChan chan any // 响应通道
}

Jump to

Keyboard shortcuts

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