rate_limit

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithRateLimitKeyContext

func WithRateLimitKeyContext(rateLimit *RateLimit) func(context.Context) context.Context

Types

type RateLimit

type RateLimit struct {
	Count    int            `env:""`
	Duration types.Duration `env:""`

	Limiter ratelimit.Limiter `env:"-"`
}

func MustRateLimitKeyFromContext

func MustRateLimitKeyFromContext(ctx context.Context) *RateLimit

func RateLimitKeyFromContext

func RateLimitKeyFromContext(ctx context.Context) (*RateLimit, bool)

func (*RateLimit) Init

func (r *RateLimit) Init()

func (*RateLimit) SetDefault

func (r *RateLimit) SetDefault()

Jump to

Keyboard shortcuts

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