@@ -1156,18 +1156,14 @@ func (c cmdable) TopKListWithCount(ctx context.Context, key string) *MapStringIn
11561156// Returns OK on success or an error if the operation could not be completed.
11571157// For more information - https://redis.io/commands/tdigest.add/
11581158func (c cmdable ) TDigestAdd (ctx context.Context , key string , elements ... float64 ) * StatusCmd {
1159- args := make ([]interface {}, 2 , 2 + len (elements ))
1159+ args := make ([]interface {}, 2 + len (elements ))
11601160 args [0 ] = "TDIGEST.ADD"
11611161 args [1 ] = key
11621162
1163- // Convert floatSlice to []interface{}
1164- interfaceSlice := make ([]interface {}, len (elements ))
11651163 for i , v := range elements {
1166- interfaceSlice [ i ] = v
1164+ args [ 2 + i ] = v
11671165 }
11681166
1169- args = append (args , interfaceSlice ... )
1170-
11711167 cmd := NewStatusCmd (ctx , args ... )
11721168 _ = c (ctx , cmd )
11731169 return cmd
@@ -1178,18 +1174,14 @@ func (c cmdable) TDigestAdd(ctx context.Context, key string, elements ...float64
11781174// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
11791175// For more information - https://redis.io/commands/tdigest.byrank/
11801176func (c cmdable ) TDigestByRank (ctx context.Context , key string , rank ... uint64 ) * FloatSliceCmd {
1181- args := make ([]interface {}, 2 , 2 + len (rank ))
1177+ args := make ([]interface {}, 2 + len (rank ))
11821178 args [0 ] = "TDIGEST.BYRANK"
11831179 args [1 ] = key
11841180
1185- // Convert uint slice to []interface{}
1186- interfaceSlice := make ([]interface {}, len (rank ))
1187- for i , v := range rank {
1188- interfaceSlice [i ] = v
1181+ for i , r := range rank {
1182+ args [2 + i ] = r
11891183 }
11901184
1191- args = append (args , interfaceSlice ... )
1192-
11931185 cmd := NewFloatSliceCmd (ctx , args ... )
11941186 _ = c (ctx , cmd )
11951187 return cmd
@@ -1200,18 +1192,14 @@ func (c cmdable) TDigestByRank(ctx context.Context, key string, rank ...uint64)
12001192// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
12011193// For more information - https://redis.io/commands/tdigest.byrevrank/
12021194func (c cmdable ) TDigestByRevRank (ctx context.Context , key string , rank ... uint64 ) * FloatSliceCmd {
1203- args := make ([]interface {}, 2 , 2 + len (rank ))
1195+ args := make ([]interface {}, 2 + len (rank ))
12041196 args [0 ] = "TDIGEST.BYREVRANK"
12051197 args [1 ] = key
12061198
1207- // Convert uint slice to []interface{}
1208- interfaceSlice := make ([]interface {}, len (rank ))
1209- for i , v := range rank {
1210- interfaceSlice [i ] = v
1199+ for i , r := range rank {
1200+ args [2 + i ] = r
12111201 }
12121202
1213- args = append (args , interfaceSlice ... )
1214-
12151203 cmd := NewFloatSliceCmd (ctx , args ... )
12161204 _ = c (ctx , cmd )
12171205 return cmd
@@ -1222,18 +1210,14 @@ func (c cmdable) TDigestByRevRank(ctx context.Context, key string, rank ...uint6
12221210// Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed.
12231211// For more information - https://redis.io/commands/tdigest.cdf/
12241212func (c cmdable ) TDigestCDF (ctx context.Context , key string , elements ... float64 ) * FloatSliceCmd {
1225- args := make ([]interface {}, 2 , 2 + len (elements ))
1213+ args := make ([]interface {}, 2 + len (elements ))
12261214 args [0 ] = "TDIGEST.CDF"
12271215 args [1 ] = key
12281216
1229- // Convert floatSlice to []interface{}
1230- interfaceSlice := make ([]interface {}, len (elements ))
12311217 for i , v := range elements {
1232- interfaceSlice [ i ] = v
1218+ args [ 2 + i ] = v
12331219 }
12341220
1235- args = append (args , interfaceSlice ... )
1236-
12371221 cmd := NewFloatSliceCmd (ctx , args ... )
12381222 _ = c (ctx , cmd )
12391223 return cmd
@@ -1424,18 +1408,14 @@ func (c cmdable) TDigestMin(ctx context.Context, key string) *FloatCmd {
14241408// Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed.
14251409// For more information - https://redis.io/commands/tdigest.quantile/
14261410func (c cmdable ) TDigestQuantile (ctx context.Context , key string , elements ... float64 ) * FloatSliceCmd {
1427- args := make ([]interface {}, 2 , 2 + len (elements ))
1411+ args := make ([]interface {}, 2 + len (elements ))
14281412 args [0 ] = "TDIGEST.QUANTILE"
14291413 args [1 ] = key
14301414
1431- // Convert floatSlice to []interface{}
1432- interfaceSlice := make ([]interface {}, len (elements ))
14331415 for i , v := range elements {
1434- interfaceSlice [ i ] = v
1416+ args [ 2 + i ] = v
14351417 }
14361418
1437- args = append (args , interfaceSlice ... )
1438-
14391419 cmd := NewFloatSliceCmd (ctx , args ... )
14401420 _ = c (ctx , cmd )
14411421 return cmd
@@ -1446,18 +1426,14 @@ func (c cmdable) TDigestQuantile(ctx context.Context, key string, elements ...fl
14461426// Returns an array of integers representing the rank values for each element or an error if the operation could not be completed.
14471427// For more information - https://redis.io/commands/tdigest.rank/
14481428func (c cmdable ) TDigestRank (ctx context.Context , key string , values ... float64 ) * IntSliceCmd {
1449- args := make ([]interface {}, 2 , 2 + len (values ))
1429+ args := make ([]interface {}, 2 + len (values ))
14501430 args [0 ] = "TDIGEST.RANK"
14511431 args [1 ] = key
14521432
1453- // Convert floatSlice to []interface{}
1454- interfaceSlice := make ([]interface {}, len (values ))
14551433 for i , v := range values {
1456- interfaceSlice [ i ] = v
1434+ args [ i + 2 ] = v
14571435 }
14581436
1459- args = append (args , interfaceSlice ... )
1460-
14611437 cmd := NewIntSliceCmd (ctx , args ... )
14621438 _ = c (ctx , cmd )
14631439 return cmd
@@ -1479,18 +1455,14 @@ func (c cmdable) TDigestReset(ctx context.Context, key string) *StatusCmd {
14791455// Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed.
14801456// For more information - https://redis.io/commands/tdigest.revrank/
14811457func (c cmdable ) TDigestRevRank (ctx context.Context , key string , values ... float64 ) * IntSliceCmd {
1482- args := make ([]interface {}, 2 , 2 + len (values ))
1458+ args := make ([]interface {}, 2 + len (values ))
14831459 args [0 ] = "TDIGEST.REVRANK"
14841460 args [1 ] = key
14851461
1486- // Convert floatSlice to []interface{}
1487- interfaceSlice := make ([]interface {}, len (values ))
14881462 for i , v := range values {
1489- interfaceSlice [ i ] = v
1463+ args [ 2 + i ] = v
14901464 }
14911465
1492- args = append (args , interfaceSlice ... )
1493-
14941466 cmd := NewIntSliceCmd (ctx , args ... )
14951467 _ = c (ctx , cmd )
14961468 return cmd
0 commit comments