mirror of https://github.com/go-redis/redis.git
Unexport Clone and Lock from embedded hooks
This commit is contained in:
parent
6bd8d9ce28
commit
512e6c7a40
|
@ -696,7 +696,7 @@ func (c *ClusterClient) WithContext(ctx context.Context) *ClusterClient {
|
|||
}
|
||||
clone := *c
|
||||
clone.cmdable = clone.Process
|
||||
clone.hooks.Lock()
|
||||
clone.hooks.lock()
|
||||
clone.ctx = ctx
|
||||
return &clone
|
||||
}
|
||||
|
|
8
redis.go
8
redis.go
|
@ -32,13 +32,13 @@ type hooks struct {
|
|||
hooks []Hook
|
||||
}
|
||||
|
||||
func (hs *hooks) Lock() {
|
||||
func (hs *hooks) lock() {
|
||||
hs.hooks = hs.hooks[:len(hs.hooks):len(hs.hooks)]
|
||||
}
|
||||
|
||||
func (hs hooks) Clone() hooks {
|
||||
func (hs hooks) clone() hooks {
|
||||
clone := hs
|
||||
clone.Lock()
|
||||
clone.lock()
|
||||
return clone
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ func NewClient(opt *Options) *Client {
|
|||
func (c *Client) clone() *Client {
|
||||
clone := *c
|
||||
clone.cmdable = clone.Process
|
||||
clone.hooks.Lock()
|
||||
clone.hooks.lock()
|
||||
return &clone
|
||||
}
|
||||
|
||||
|
|
2
ring.go
2
ring.go
|
@ -407,7 +407,7 @@ func (c *Ring) WithContext(ctx context.Context) *Ring {
|
|||
}
|
||||
clone := *c
|
||||
clone.cmdable = clone.Process
|
||||
clone.hooks.Lock()
|
||||
clone.hooks.lock()
|
||||
clone.ctx = ctx
|
||||
return &clone
|
||||
}
|
||||
|
|
4
tx.go
4
tx.go
|
@ -28,7 +28,7 @@ func (c *Client) newTx(ctx context.Context) *Tx {
|
|||
opt: c.opt,
|
||||
connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), true),
|
||||
},
|
||||
hooks: c.hooks.Clone(),
|
||||
hooks: c.hooks.clone(),
|
||||
ctx: ctx,
|
||||
}
|
||||
tx.init()
|
||||
|
@ -50,7 +50,7 @@ func (c *Tx) WithContext(ctx context.Context) *Tx {
|
|||
}
|
||||
clone := *c
|
||||
clone.init()
|
||||
clone.hooks.Lock()
|
||||
clone.hooks.lock()
|
||||
clone.ctx = ctx
|
||||
return &clone
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue