@@ -1116,18 +1116,14 @@ func (c cmdable) TopKListWithCount(ctx context.Context, key string) *MapStringIn
11161116// Returns OK on success or an error if the operation could not be completed.
11171117// For more information - https://redis.io/commands/tdigest.add/
11181118func (c cmdable ) TDigestAdd (ctx context.Context , key string , elements ... float64 ) * StatusCmd {
1119- args := make ([]interface {}, 2 , 2 + len (elements ))
1119+ args := make ([]interface {}, 2 + len (elements ))
11201120 args [0 ] = "TDIGEST.ADD"
11211121 args [1 ] = key
11221122
1123- // Convert floatSlice to []interface{}
1124- interfaceSlice := make ([]interface {}, len (elements ))
11251123 for i , v := range elements {
1126- interfaceSlice [ i ] = v
1124+ args [ 2 + i ] = v
11271125 }
11281126
1129- args = append (args , interfaceSlice ... )
1130-
11311127 cmd := NewStatusCmd (ctx , args ... )
11321128 _ = c (ctx , cmd )
11331129 return cmd
@@ -1138,18 +1134,14 @@ func (c cmdable) TDigestAdd(ctx context.Context, key string, elements ...float64
11381134// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
11391135// For more information - https://redis.io/commands/tdigest.byrank/
11401136func (c cmdable ) TDigestByRank (ctx context.Context , key string , rank ... uint64 ) * FloatSliceCmd {
1141- args := make ([]interface {}, 2 , 2 + len (rank ))
1137+ args := make ([]interface {}, 2 + len (rank ))
11421138 args [0 ] = "TDIGEST.BYRANK"
11431139 args [1 ] = key
11441140
1145- // Convert uint slice to []interface{}
1146- interfaceSlice := make ([]interface {}, len (rank ))
1147- for i , v := range rank {
1148- interfaceSlice [i ] = v
1141+ for i , r := range rank {
1142+ args [2 + i ] = r
11491143 }
11501144
1151- args = append (args , interfaceSlice ... )
1152-
11531145 cmd := NewFloatSliceCmd (ctx , args ... )
11541146 _ = c (ctx , cmd )
11551147 return cmd
@@ -1160,18 +1152,14 @@ func (c cmdable) TDigestByRank(ctx context.Context, key string, rank ...uint64)
11601152// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
11611153// For more information - https://redis.io/commands/tdigest.byrevrank/
11621154func (c cmdable ) TDigestByRevRank (ctx context.Context , key string , rank ... uint64 ) * FloatSliceCmd {
1163- args := make ([]interface {}, 2 , 2 + len (rank ))
1155+ args := make ([]interface {}, 2 + len (rank ))
11641156 args [0 ] = "TDIGEST.BYREVRANK"
11651157 args [1 ] = key
11661158
1167- // Convert uint slice to []interface{}
1168- interfaceSlice := make ([]interface {}, len (rank ))
1169- for i , v := range rank {
1170- interfaceSlice [i ] = v
1159+ for i , r := range rank {
1160+ args [2 + i ] = r
11711161 }
11721162
1173- args = append (args , interfaceSlice ... )
1174-
11751163 cmd := NewFloatSliceCmd (ctx , args ... )
11761164 _ = c (ctx , cmd )
11771165 return cmd
@@ -1182,18 +1170,14 @@ func (c cmdable) TDigestByRevRank(ctx context.Context, key string, rank ...uint6
11821170// Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed.
11831171// For more information - https://redis.io/commands/tdigest.cdf/
11841172func (c cmdable ) TDigestCDF (ctx context.Context , key string , elements ... float64 ) * FloatSliceCmd {
1185- args := make ([]interface {}, 2 , 2 + len (elements ))
1173+ args := make ([]interface {}, 2 + len (elements ))
11861174 args [0 ] = "TDIGEST.CDF"
11871175 args [1 ] = key
11881176
1189- // Convert floatSlice to []interface{}
1190- interfaceSlice := make ([]interface {}, len (elements ))
11911177 for i , v := range elements {
1192- interfaceSlice [ i ] = v
1178+ args [ 2 + i ] = v
11931179 }
11941180
1195- args = append (args , interfaceSlice ... )
1196-
11971181 cmd := NewFloatSliceCmd (ctx , args ... )
11981182 _ = c (ctx , cmd )
11991183 return cmd
@@ -1376,18 +1360,14 @@ func (c cmdable) TDigestMin(ctx context.Context, key string) *FloatCmd {
13761360// Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed.
13771361// For more information - https://redis.io/commands/tdigest.quantile/
13781362func (c cmdable ) TDigestQuantile (ctx context.Context , key string , elements ... float64 ) * FloatSliceCmd {
1379- args := make ([]interface {}, 2 , 2 + len (elements ))
1363+ args := make ([]interface {}, 2 + len (elements ))
13801364 args [0 ] = "TDIGEST.QUANTILE"
13811365 args [1 ] = key
13821366
1383- // Convert floatSlice to []interface{}
1384- interfaceSlice := make ([]interface {}, len (elements ))
13851367 for i , v := range elements {
1386- interfaceSlice [ i ] = v
1368+ args [ 2 + i ] = v
13871369 }
13881370
1389- args = append (args , interfaceSlice ... )
1390-
13911371 cmd := NewFloatSliceCmd (ctx , args ... )
13921372 _ = c (ctx , cmd )
13931373 return cmd
@@ -1398,18 +1378,14 @@ func (c cmdable) TDigestQuantile(ctx context.Context, key string, elements ...fl
13981378// Returns an array of integers representing the rank values for each element or an error if the operation could not be completed.
13991379// For more information - https://redis.io/commands/tdigest.rank/
14001380func (c cmdable ) TDigestRank (ctx context.Context , key string , values ... float64 ) * IntSliceCmd {
1401- args := make ([]interface {}, 2 , 2 + len (values ))
1381+ args := make ([]interface {}, 2 + len (values ))
14021382 args [0 ] = "TDIGEST.RANK"
14031383 args [1 ] = key
14041384
1405- // Convert floatSlice to []interface{}
1406- interfaceSlice := make ([]interface {}, len (values ))
14071385 for i , v := range values {
1408- interfaceSlice [ i ] = v
1386+ args [ i + 2 ] = v
14091387 }
14101388
1411- args = append (args , interfaceSlice ... )
1412-
14131389 cmd := NewIntSliceCmd (ctx , args ... )
14141390 _ = c (ctx , cmd )
14151391 return cmd
@@ -1431,18 +1407,14 @@ func (c cmdable) TDigestReset(ctx context.Context, key string) *StatusCmd {
14311407// Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed.
14321408// For more information - https://redis.io/commands/tdigest.revrank/
14331409func (c cmdable ) TDigestRevRank (ctx context.Context , key string , values ... float64 ) * IntSliceCmd {
1434- args := make ([]interface {}, 2 , 2 + len (values ))
1410+ args := make ([]interface {}, 2 + len (values ))
14351411 args [0 ] = "TDIGEST.REVRANK"
14361412 args [1 ] = key
14371413
1438- // Convert floatSlice to []interface{}
1439- interfaceSlice := make ([]interface {}, len (values ))
14401414 for i , v := range values {
1441- interfaceSlice [ i ] = v
1415+ args [ 2 + i ] = v
14421416 }
14431417
1444- args = append (args , interfaceSlice ... )
1445-
14461418 cmd := NewIntSliceCmd (ctx , args ... )
14471419 _ = c (ctx , cmd )
14481420 return cmd
0 commit comments