添加单元测试
This commit is contained in:
+19
-1
@@ -35,7 +35,7 @@ func InitOption(opts ...Option) {
|
||||
|
||||
type Option func(*option)
|
||||
|
||||
func WithTimeout(t time.Duration) Option {
|
||||
func WithLockTimeout(t time.Duration) Option {
|
||||
return func(o *option) {
|
||||
o.lockTimeout = t
|
||||
}
|
||||
@@ -53,6 +53,24 @@ func WithExpiry(expiry time.Duration) Option {
|
||||
}
|
||||
}
|
||||
|
||||
func WithRefreshPeriod(period time.Duration) Option {
|
||||
return func(o *option) {
|
||||
o.RefreshPeriod = period
|
||||
}
|
||||
}
|
||||
|
||||
func WithMaxRetryTimes(times int) Option {
|
||||
return func(o *option) {
|
||||
o.MaxRetryTimes = times
|
||||
}
|
||||
}
|
||||
|
||||
func WithRetryInterval(interval time.Duration) Option {
|
||||
return func(o *option) {
|
||||
o.RetryInterval = interval
|
||||
}
|
||||
}
|
||||
|
||||
type Logger interface {
|
||||
Errorf(ctx context.Context, format string, v ...any)
|
||||
Infof(ctx context.Context, format string, v ...any)
|
||||
|
||||
Reference in New Issue
Block a user