添加单元测试

This commit is contained in:
Yun
2025-09-17 19:30:18 +08:00
parent 4a131290d6
commit 7ceb13d438
5 changed files with 513 additions and 1 deletions
+19 -1
View File
@@ -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)