mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-17 16:12:42 +08:00
使用接口返回
This commit is contained in:
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user