Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDecorator ¶
type IDecorator interface {
Decorate(method func(args ...interface{}) (interface{}, error)) func(args ...interface{}) (interface{}, error)
}
IDecorator is the interface for decorators.
type LimiterDecorator ¶
type LimiterDecorator struct {
// contains filtered or unexported fields
}
LimiterDecorator manages rate limiting for decorated functions.
func NewLimiterDecorator ¶
func NewLimiterDecorator(rateLimit time.Duration, maxConcurrent int) *LimiterDecorator
NewLimiterDecorator initializes a LimiterDecorator with specified options.
func (*LimiterDecorator) Decorate ¶
func (d *LimiterDecorator) Decorate(method func(args ...interface{}) (interface{}, error)) func(args ...interface{}) (interface{}, error)
Decorate wraps the given method with rate limiting.
func (*LimiterDecorator) DisableLimiter ¶
func (d *LimiterDecorator) DisableLimiter()
DisableLimiter deactivates the rate limiter.
func (*LimiterDecorator) EnableLimiter ¶
func (d *LimiterDecorator) EnableLimiter()
EnableLimiter activates the rate limiter.
type RetryDecorator ¶
type RetryDecorator struct { TenSecondlyRolling string SecondlyLimitMessage string RetryTimeout map[int]time.Duration NumberOfApiCallRetries int }
RetryDecorator struct to handle retry logic
func NewRetryDecorator ¶
func NewRetryDecorator(numberOfApiCallRetries int) *RetryDecorator
NewRetryDecorator initializes a RetryDecorator with specified retries
func (*RetryDecorator) Decorate ¶
func (d *RetryDecorator) Decorate(method func(args ...interface{}) (interface{}, error)) func(args ...interface{}) (interface{}, error)
Decorate wraps a method with retry logic
Click to show internal directories.
Click to hide internal directories.