go-redis icon indicating copy to clipboard operation
go-redis copied to clipboard

Can't call NewScanCmd

Open bigdaronlee163 opened this issue 2 years ago • 0 comments

tag v8.0.0-beta.6 NewScanCmd has parameter process cmdable cmdable is not public interface. So we can't pass a value to a cmdable this is my cmdale type tairCmdable func(ctx context.Context, cmd redis.Cmder) error // cmdable 是一个函数接口

I want to extend same command based on go-redis 
 // todo  cmdable not export
func (tc tairCmdable) TrScan(ctx context.Context,key string, cursor int64, count int64) *redis.ScanCmd {
	a := make([]interface{}, 4)
	a[0] = "tr.scan"
	a[1] = key
	a[2] = cursor
	a[3] = count
	cmd := redis.NewScanCmd(ctx, interface{}(tc).(redis.cmdable), a...)
	_ = tc(ctx, cmd)
	return cmd
}


but it not successed due to NewScanCmd
## Expected Behavior
I cannot pass it to NewScanCmd()
we can't pass a value to a cmdable

func NewScanCmd(ctx context.Context, process cmdable, args ...interface{}) *ScanCm

<!--- Tell us what should happen -->

how change tairCmadle to cmdable 

bigdaronlee163 avatar Jul 21 '22 15:07 bigdaronlee163