Exported function returning value of unexported type RVV-B0011
Anti-pattern
Critical
5 months ago3 years old
exported func WithRejectionResponse returns unexported type ratelimit.limiterOption, which can be annoying to use
107
108// WithRejectionResponse return limiterOption. WithRejectionResponse
109// customize the response for the request rejected by the limiter.
110func WithRejectionResponse(resp RejectionResponse) limiterOption {111	return func(l *limiter) {
112		l.resp = resp
113	}
exported func WithBucketFactory returns unexported type ratelimit.limiterOption, which can be annoying to use
 99
100// WithBucketFactory return limiterOption. WithBucketFactory customize the
101// implementation of Bucket.
102func WithBucketFactory(f func(opts ...bucketOption) bucket) limiterOption {103	return func(l *limiter) {
104		l.bucketFactory = f
105	}
exported func WithCapacity returns unexported type ratelimit.limiterOption, which can be annoying to use
 91// WithCapacity return limiterOption. WithCapacity config the capacity size.
 92// The bucket with a capacity of n has n tokens after initialization. The capacity
 93// defines how many requests a client can make in excess of the rate.
 94func WithCapacity(c uint) limiterOption { 95	return func(l *limiter) {
 96		l.capacity = c
 97	}
exported func WithRate returns unexported type ratelimit.limiterOption, which can be annoying to use
 82
 83// WithRate return limiterOption. WithRate config how long it takes to
 84// generate a token.
 85func WithRate(r time.Duration) limiterOption { 86	return func(l *limiter) {
 87		l.rate = r
 88	}
exported func WithSessionKey returns unexported type ratelimit.limiterOption, which can be annoying to use
 74
 75// WithSessionKey return limiterOption. WithSessionKey config func
 76// which defines the request characteristic against the limit is applied
 77func WithSessionKey(f func(ctx *context.Context) string) limiterOption { 78	return func(l *limiter) {
 79		l.sessionKey = f
 80	}