awesome-compose/go-mysql-redis/vendor/gopkg.in/redis.v5/redis_context.go
vishal979 207f73ab81 add go mysql redis sample
Signed-off-by: vishal979 <shantapowertech2@gmail.com>
2020-07-04 19:38:53 +05:30

36 lines
529 B
Go

// +build go1.7
package redis
import (
"context"
"gopkg.in/redis.v5/internal/pool"
)
type baseClient struct {
connPool pool.Pooler
opt *Options
process func(Cmder) error
onClose func() error // hook called when client is closed
ctx context.Context
}
func (c *Client) Context() context.Context {
if c.ctx != nil {
return c.ctx
}
return context.Background()
}
func (c *Client) WithContext(ctx context.Context) *Client {
if ctx == nil {
panic("nil context")
}
c2 := c.copy()
c2.ctx = ctx
return c2
}