tests

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeRateLimitProvider

type FakeRateLimitProvider struct {
	CheckAllowed bool
	CheckCount   int
	CheckReset   time.Time
	CheckErr     error

	GetErr error
	SetErr error
	Store  map[string]types.RateLimitRuleRecord

	LastCheckKey    string
	LastCheckWindow time.Duration
	LastCheckMax    int
	GetCalls        int
	SetCalls        int
	LastSetKey      string
	LastSetWindow   time.Duration
	LastSetMax      int
}

func NewFakeRateLimitProvider

func NewFakeRateLimitProvider() *FakeRateLimitProvider

func (*FakeRateLimitProvider) CheckAndIncrement

func (p *FakeRateLimitProvider) CheckAndIncrement(_ context.Context, key string, window time.Duration, maxRequests int) (bool, int, time.Time, error)

func (*FakeRateLimitProvider) Close

func (p *FakeRateLimitProvider) Close() error

func (*FakeRateLimitProvider) DeleteRule

func (p *FakeRateLimitProvider) DeleteRule(_ context.Context, key string) error

func (*FakeRateLimitProvider) GetName

func (p *FakeRateLimitProvider) GetName() string

func (*FakeRateLimitProvider) GetRule

func (*FakeRateLimitProvider) SetRule

func (p *FakeRateLimitProvider) SetRule(_ context.Context, key string, window time.Duration, maxRequests int) error

func (*FakeRateLimitProvider) WithCheckError

func (p *FakeRateLimitProvider) WithCheckError(err error) *FakeRateLimitProvider

func (*FakeRateLimitProvider) WithCheckResult

func (p *FakeRateLimitProvider) WithCheckResult(allowed bool, count int, reset time.Time, err error) *FakeRateLimitProvider

func (*FakeRateLimitProvider) WithExistingRule

func (p *FakeRateLimitProvider) WithExistingRule(key string, window time.Duration, max int) *FakeRateLimitProvider

func (*FakeRateLimitProvider) WithGetError

func (p *FakeRateLimitProvider) WithGetError(err error) *FakeRateLimitProvider

func (*FakeRateLimitProvider) WithSetError

func (p *FakeRateLimitProvider) WithSetError(err error) *FakeRateLimitProvider

Jump to

Keyboard shortcuts

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