@@ -1116,18 +1116,14 @@ func (c cmdable) TopKListWithCount(ctx context.Context, key string) *MapStringIn
1116
1116
// Returns OK on success or an error if the operation could not be completed.
1117
1117
// For more information - https://redis.io/commands/tdigest.add/
1118
1118
func (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 ))
1120
1120
args [0 ] = "TDIGEST.ADD"
1121
1121
args [1 ] = key
1122
1122
1123
- // Convert floatSlice to []interface{}
1124
- interfaceSlice := make ([]interface {}, len (elements ))
1125
1123
for i , v := range elements {
1126
- interfaceSlice [ i ] = v
1124
+ args [ 2 + i ] = v
1127
1125
}
1128
1126
1129
- args = append (args , interfaceSlice ... )
1130
-
1131
1127
cmd := NewStatusCmd (ctx , args ... )
1132
1128
_ = c (ctx , cmd )
1133
1129
return cmd
@@ -1138,18 +1134,14 @@ func (c cmdable) TDigestAdd(ctx context.Context, key string, elements ...float64
1138
1134
// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
1139
1135
// For more information - https://redis.io/commands/tdigest.byrank/
1140
1136
func (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 ))
1142
1138
args [0 ] = "TDIGEST.BYRANK"
1143
1139
args [1 ] = key
1144
1140
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
1149
1143
}
1150
1144
1151
- args = append (args , interfaceSlice ... )
1152
-
1153
1145
cmd := NewFloatSliceCmd (ctx , args ... )
1154
1146
_ = c (ctx , cmd )
1155
1147
return cmd
@@ -1160,18 +1152,14 @@ func (c cmdable) TDigestByRank(ctx context.Context, key string, rank ...uint64)
1160
1152
// Returns an array of floats representing the values at the specified ranks or an error if the operation could not be completed.
1161
1153
// For more information - https://redis.io/commands/tdigest.byrevrank/
1162
1154
func (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 ))
1164
1156
args [0 ] = "TDIGEST.BYREVRANK"
1165
1157
args [1 ] = key
1166
1158
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
1171
1161
}
1172
1162
1173
- args = append (args , interfaceSlice ... )
1174
-
1175
1163
cmd := NewFloatSliceCmd (ctx , args ... )
1176
1164
_ = c (ctx , cmd )
1177
1165
return cmd
@@ -1182,18 +1170,14 @@ func (c cmdable) TDigestByRevRank(ctx context.Context, key string, rank ...uint6
1182
1170
// Returns an array of floats representing the CDF values for each element or an error if the operation could not be completed.
1183
1171
// For more information - https://redis.io/commands/tdigest.cdf/
1184
1172
func (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 ))
1186
1174
args [0 ] = "TDIGEST.CDF"
1187
1175
args [1 ] = key
1188
1176
1189
- // Convert floatSlice to []interface{}
1190
- interfaceSlice := make ([]interface {}, len (elements ))
1191
1177
for i , v := range elements {
1192
- interfaceSlice [ i ] = v
1178
+ args [ 2 + i ] = v
1193
1179
}
1194
1180
1195
- args = append (args , interfaceSlice ... )
1196
-
1197
1181
cmd := NewFloatSliceCmd (ctx , args ... )
1198
1182
_ = c (ctx , cmd )
1199
1183
return cmd
@@ -1376,18 +1360,14 @@ func (c cmdable) TDigestMin(ctx context.Context, key string) *FloatCmd {
1376
1360
// Returns an array of floats representing the quantile values for each element or an error if the operation could not be completed.
1377
1361
// For more information - https://redis.io/commands/tdigest.quantile/
1378
1362
func (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 ))
1380
1364
args [0 ] = "TDIGEST.QUANTILE"
1381
1365
args [1 ] = key
1382
1366
1383
- // Convert floatSlice to []interface{}
1384
- interfaceSlice := make ([]interface {}, len (elements ))
1385
1367
for i , v := range elements {
1386
- interfaceSlice [ i ] = v
1368
+ args [ 2 + i ] = v
1387
1369
}
1388
1370
1389
- args = append (args , interfaceSlice ... )
1390
-
1391
1371
cmd := NewFloatSliceCmd (ctx , args ... )
1392
1372
_ = c (ctx , cmd )
1393
1373
return cmd
@@ -1398,18 +1378,14 @@ func (c cmdable) TDigestQuantile(ctx context.Context, key string, elements ...fl
1398
1378
// Returns an array of integers representing the rank values for each element or an error if the operation could not be completed.
1399
1379
// For more information - https://redis.io/commands/tdigest.rank/
1400
1380
func (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 ))
1402
1382
args [0 ] = "TDIGEST.RANK"
1403
1383
args [1 ] = key
1404
1384
1405
- // Convert floatSlice to []interface{}
1406
- interfaceSlice := make ([]interface {}, len (values ))
1407
1385
for i , v := range values {
1408
- interfaceSlice [ i ] = v
1386
+ args [ i + 2 ] = v
1409
1387
}
1410
1388
1411
- args = append (args , interfaceSlice ... )
1412
-
1413
1389
cmd := NewIntSliceCmd (ctx , args ... )
1414
1390
_ = c (ctx , cmd )
1415
1391
return cmd
@@ -1431,18 +1407,14 @@ func (c cmdable) TDigestReset(ctx context.Context, key string) *StatusCmd {
1431
1407
// Returns an array of integers representing the reverse rank values for each element or an error if the operation could not be completed.
1432
1408
// For more information - https://redis.io/commands/tdigest.revrank/
1433
1409
func (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 ))
1435
1411
args [0 ] = "TDIGEST.REVRANK"
1436
1412
args [1 ] = key
1437
1413
1438
- // Convert floatSlice to []interface{}
1439
- interfaceSlice := make ([]interface {}, len (values ))
1440
1414
for i , v := range values {
1441
- interfaceSlice [ i ] = v
1415
+ args [ 2 + i ] = v
1442
1416
}
1443
1417
1444
- args = append (args , interfaceSlice ... )
1445
-
1446
1418
cmd := NewIntSliceCmd (ctx , args ... )
1447
1419
_ = c (ctx , cmd )
1448
1420
return cmd
0 commit comments