@@ -1156,18 +1156,14 @@ func (c cmdable) TopKListWithCount(ctx context.Context, key string) *MapStringIn
1156
1156
// Returns OK on success or an error if the operation could not be completed.
1157
1157
// For more information - https://redis.io/commands/tdigest.add/
1158
1158
func (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 ))
1160
1160
args [0 ] = "TDIGEST.ADD"
1161
1161
args [1 ] = key
1162
1162
1163
- // Convert floatSlice to []interface{}
1164
- interfaceSlice := make ([]interface {}, len (elements ))
1165
1163
for i , v := range elements {
1166
- interfaceSlice [ i ] = v
1164
+ args [ 2 + i ] = v
1167
1165
}
1168
1166
1169
- args = append (args , interfaceSlice ... )
1170
-
1171
1167
cmd := NewStatusCmd (ctx , args ... )
1172
1168
_ = c (ctx , cmd )
1173
1169
return cmd
@@ -1178,18 +1174,14 @@ func (c cmdable) TDigestAdd(ctx context.Context, key string, elements ...float64
1178
1174
// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
1179
1175
// For more information - https://redis.io/commands/tdigest.byrank/
1180
1176
func (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 ))
1182
1178
args [0 ] = "TDIGEST.BYRANK"
1183
1179
args [1 ] = key
1184
1180
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
1189
1183
}
1190
1184
1191
- args = append (args , interfaceSlice ... )
1192
-
1193
1185
cmd := NewFloatSliceCmd (ctx , args ... )
1194
1186
_ = c (ctx , cmd )
1195
1187
return cmd
@@ -1200,18 +1192,14 @@ func (c cmdable) TDigestByRank(ctx context.Context, key string, rank ...uint64)
1200
1192
// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
1201
1193
// For more information - https://redis.io/commands/tdigest.byrevrank/
1202
1194
func (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 ))
1204
1196
args [0 ] = "TDIGEST.BYREVRANK"
1205
1197
args [1 ] = key
1206
1198
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
1211
1201
}
1212
1202
1213
- args = append (args , interfaceSlice ... )
1214
-
1215
1203
cmd := NewFloatSliceCmd (ctx , args ... )
1216
1204
_ = c (ctx , cmd )
1217
1205
return cmd
@@ -1222,18 +1210,14 @@ func (c cmdable) TDigestByRevRank(ctx context.Context, key string, rank ...uint6
1222
1210
// Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed.
1223
1211
// For more information - https://redis.io/commands/tdigest.cdf/
1224
1212
func (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 ))
1226
1214
args [0 ] = "TDIGEST.CDF"
1227
1215
args [1 ] = key
1228
1216
1229
- // Convert floatSlice to []interface{}
1230
- interfaceSlice := make ([]interface {}, len (elements ))
1231
1217
for i , v := range elements {
1232
- interfaceSlice [ i ] = v
1218
+ args [ 2 + i ] = v
1233
1219
}
1234
1220
1235
- args = append (args , interfaceSlice ... )
1236
-
1237
1221
cmd := NewFloatSliceCmd (ctx , args ... )
1238
1222
_ = c (ctx , cmd )
1239
1223
return cmd
@@ -1424,18 +1408,14 @@ func (c cmdable) TDigestMin(ctx context.Context, key string) *FloatCmd {
1424
1408
// Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed.
1425
1409
// For more information - https://redis.io/commands/tdigest.quantile/
1426
1410
func (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 ))
1428
1412
args [0 ] = "TDIGEST.QUANTILE"
1429
1413
args [1 ] = key
1430
1414
1431
- // Convert floatSlice to []interface{}
1432
- interfaceSlice := make ([]interface {}, len (elements ))
1433
1415
for i , v := range elements {
1434
- interfaceSlice [ i ] = v
1416
+ args [ 2 + i ] = v
1435
1417
}
1436
1418
1437
- args = append (args , interfaceSlice ... )
1438
-
1439
1419
cmd := NewFloatSliceCmd (ctx , args ... )
1440
1420
_ = c (ctx , cmd )
1441
1421
return cmd
@@ -1446,18 +1426,14 @@ func (c cmdable) TDigestQuantile(ctx context.Context, key string, elements ...fl
1446
1426
// Returns an array of integers representing the rank values for each element or an error if the operation could not be completed.
1447
1427
// For more information - https://redis.io/commands/tdigest.rank/
1448
1428
func (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 ))
1450
1430
args [0 ] = "TDIGEST.RANK"
1451
1431
args [1 ] = key
1452
1432
1453
- // Convert floatSlice to []interface{}
1454
- interfaceSlice := make ([]interface {}, len (values ))
1455
1433
for i , v := range values {
1456
- interfaceSlice [ i ] = v
1434
+ args [ i + 2 ] = v
1457
1435
}
1458
1436
1459
- args = append (args , interfaceSlice ... )
1460
-
1461
1437
cmd := NewIntSliceCmd (ctx , args ... )
1462
1438
_ = c (ctx , cmd )
1463
1439
return cmd
@@ -1479,18 +1455,14 @@ func (c cmdable) TDigestReset(ctx context.Context, key string) *StatusCmd {
1479
1455
// Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed.
1480
1456
// For more information - https://redis.io/commands/tdigest.revrank/
1481
1457
func (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 ))
1483
1459
args [0 ] = "TDIGEST.REVRANK"
1484
1460
args [1 ] = key
1485
1461
1486
- // Convert floatSlice to []interface{}
1487
- interfaceSlice := make ([]interface {}, len (values ))
1488
1462
for i , v := range values {
1489
- interfaceSlice [ i ] = v
1463
+ args [ 2 + i ] = v
1490
1464
}
1491
1465
1492
- args = append (args , interfaceSlice ... )
1493
-
1494
1466
cmd := NewIntSliceCmd (ctx , args ... )
1495
1467
_ = c (ctx , cmd )
1496
1468
return cmd
0 commit comments