1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-17 16:12:42 +08:00

使用接口返回

This commit is contained in:
2023-10-12 14:45:50 +08:00
parent 95ad0941a8
commit 0df55ed551
2 changed files with 5 additions and 3 deletions

View File

@ -16,6 +16,8 @@ const (
defaultSlowThreshold = time.Millisecond * 100 // 慢查询
)
var Nil = redis.Nil
var (
once sync.Once
)
@ -43,7 +45,7 @@ type ReidsOption struct {
ConnMaxLifetime time.Duration
}
type Client struct {
type Client interface {
redis.UniversalClient
}
@ -79,5 +81,5 @@ func New(opt *ReidsOption) Client {
}
})
return Client{UniversalClient: rdb}
return rdb
}

View File

@ -145,7 +145,7 @@ func runOnRedis(t *testing.T, fn func(client Client)) {
func CreateMiniRedis() (r Client, clean func(), err error) {
mr, err := miniredis.Run()
if err != nil {
return Client{}, nil, err
return nil, nil, err
}
addr := mr.Addr()