limiter

package
v1.205.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingKey for limiter.
	ErrMissingKey = errors.New("missing key")
)
View Source
var Module = fx.Options(
	fx.Provide(New),
)

Module for fx.

Functions

func IsEnabled added in v1.166.0

func IsEnabled(cfg *Config) bool

IsEnabled limiter.

func RegisterKey added in v1.204.0

func RegisterKey(name string, fn KeyFunc)

RegisterKey with name and fn. Last register wins.

Types

type Config added in v1.166.0

type Config struct {
	Kind    string `yaml:"kind,omitempty" json:"kind,omitempty" toml:"kind,omitempty"`
	Pattern string `yaml:"pattern,omitempty" json:"pattern,omitempty" toml:"pattern,omitempty"`
}

Config for limiter.

type KeyFunc

type KeyFunc func(context.Context) meta.Valuer

KeyFunc for the limiter.

func New

func New(cfg *Config) (*limiter.Limiter, KeyFunc, error)

New limiter.

Jump to

Keyboard shortcuts

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