2 Commits

Author SHA1 Message Date
127c57dc3a refactor: rename timeout ctx 2025-07-15 11:43:15 +08:00
d6b0b8ea36 fix: api opt setting 2025-07-15 11:18:54 +08:00
3 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ type option struct {
func WithName(name string) Option {
return func(o *option) {
if name == "" {
if name != "" {
o.name = name
}
}
@ -31,7 +31,7 @@ func WithName(name string) Option {
func WithVersion(version string) Option {
return func(o *option) {
if version == "" {
if version != "" {
o.version = version
}
}
@ -39,7 +39,7 @@ func WithVersion(version string) Option {
func WithAddress(address string) Option {
return func(o *option) {
if address == "" {
if address != "" {
o.address = address
}
}

View File

@ -45,7 +45,7 @@ func New(opts ...OptionFn) (Cache, error) {
Password: password,
})
if err = client.Ping(tool.CtxTimeout(cfg.ctx, 5)).Err(); err != nil {
if err = client.Ping(tool.TimeoutCtx(cfg.ctx, 5)).Err(); err != nil {
return nil, err
}

View File

@ -23,7 +23,7 @@ func Timeout(seconds ...int) (ctx context.Context) {
return
}
func CtxTimeout(ctx context.Context, seconds ...int) context.Context {
func TimeoutCtx(ctx context.Context, seconds ...int) context.Context {
var (
duration time.Duration
)