@@ -3135,6 +3135,310 @@ var _ = Describe("Commands", func() {
3135
3135
return client .ACLDryRun (ctx , "default" , "get" , "key" )
3136
3136
})
3137
3137
})
3138
+
3139
+ // ------------------------------------------------------------------
3140
+
3141
+ It ("TSAdd" , func () {
3142
+ operationIntCmd (clientMock , func () * ExpectedInt {
3143
+ return clientMock .ExpectTSAdd ("key" , 1 , 2.0 )
3144
+ }, func () * redis.IntCmd {
3145
+ return client .TSAdd (ctx , "key" , 1 , 2.0 )
3146
+ })
3147
+ })
3148
+
3149
+ It ("TSAddWithArgs" , func () {
3150
+ operationIntCmd (clientMock , func () * ExpectedInt {
3151
+ return clientMock .ExpectTSAddWithArgs ("key" , 1 , 2.0 , & redis.TSOptions {
3152
+ Retention : 1 ,
3153
+ ChunkSize : 1000 ,
3154
+ })
3155
+ }, func () * redis.IntCmd {
3156
+ return client .TSAddWithArgs (ctx , "key" , 1 , 2.0 , & redis.TSOptions {
3157
+ Retention : 1 ,
3158
+ ChunkSize : 1000 ,
3159
+ })
3160
+ })
3161
+ })
3162
+
3163
+ It ("TSCreate" , func () {
3164
+ operationStatusCmd (clientMock , func () * ExpectedStatus {
3165
+ return clientMock .ExpectTSCreate ("key" )
3166
+ }, func () * redis.StatusCmd {
3167
+ return client .TSCreate (ctx , "key" )
3168
+ })
3169
+ })
3170
+
3171
+ It ("TSCreateWithArgs" , func () {
3172
+ operationStatusCmd (clientMock , func () * ExpectedStatus {
3173
+ return clientMock .ExpectTSCreateWithArgs ("key" , & redis.TSOptions {
3174
+ Retention : 1 ,
3175
+ ChunkSize : 1000 ,
3176
+ })
3177
+ }, func () * redis.StatusCmd {
3178
+ return client .TSCreateWithArgs (ctx , "key" , & redis.TSOptions {
3179
+ Retention : 1 ,
3180
+ ChunkSize : 1000 ,
3181
+ })
3182
+ })
3183
+ })
3184
+
3185
+ It ("TSAlter" , func () {
3186
+ operationStatusCmd (clientMock , func () * ExpectedStatus {
3187
+ return clientMock .ExpectTSAlter ("key" , & redis.TSAlterOptions {
3188
+ Retention : 1 ,
3189
+ ChunkSize : 1000 ,
3190
+ })
3191
+ }, func () * redis.StatusCmd {
3192
+ return client .TSAlter (ctx , "key" , & redis.TSAlterOptions {
3193
+ Retention : 1 ,
3194
+ ChunkSize : 1000 ,
3195
+ })
3196
+ })
3197
+ })
3198
+
3199
+ It ("TSCreateRule" , func () {
3200
+ operationStatusCmd (clientMock , func () * ExpectedStatus {
3201
+ return clientMock .ExpectTSCreateRule ("sourceKey" , "destKey" , redis .Aggregator (1 ), 60 )
3202
+ }, func () * redis.StatusCmd {
3203
+ return client .TSCreateRule (ctx , "sourceKey" , "destKey" , redis .Aggregator (1 ), 60 )
3204
+ })
3205
+ })
3206
+
3207
+ It ("TSCreateRuleWithArgs" , func () {
3208
+ operationStatusCmd (clientMock , func () * ExpectedStatus {
3209
+ return clientMock .ExpectTSCreateRuleWithArgs ("sourceKey" , "destKey" , redis .Aggregator (1 ), 60 , & redis.TSCreateRuleOptions {})
3210
+ }, func () * redis.StatusCmd {
3211
+ return client .TSCreateRuleWithArgs (ctx , "sourceKey" , "destKey" , redis .Aggregator (1 ), 60 , & redis.TSCreateRuleOptions {})
3212
+ })
3213
+ })
3214
+
3215
+ It ("TSIncrBy" , func () {
3216
+ operationIntCmd (clientMock , func () * ExpectedInt {
3217
+ return clientMock .ExpectTSIncrBy ("key" , 2.0 )
3218
+ }, func () * redis.IntCmd {
3219
+ return client .TSIncrBy (ctx , "key" , 2.0 )
3220
+ })
3221
+ })
3222
+
3223
+ It ("TSIncrByWithArgs" , func () {
3224
+ operationIntCmd (clientMock , func () * ExpectedInt {
3225
+ return clientMock .ExpectTSIncrByWithArgs ("key" , 2.0 , & redis.TSIncrDecrOptions {
3226
+ Retention : 1 ,
3227
+ ChunkSize : 1000 ,
3228
+ })
3229
+ }, func () * redis.IntCmd {
3230
+ return client .TSIncrByWithArgs (ctx , "key" , 2.0 , & redis.TSIncrDecrOptions {
3231
+ Retention : 1 ,
3232
+ ChunkSize : 1000 ,
3233
+ })
3234
+ })
3235
+ })
3236
+
3237
+ It ("DecrBy" , func () {
3238
+ operationIntCmd (clientMock , func () * ExpectedInt {
3239
+ return clientMock .ExpectTSDecrBy ("key" , 2.0 )
3240
+ }, func () * redis.IntCmd {
3241
+ return client .TSDecrBy (ctx , "key" , 2.0 )
3242
+ })
3243
+ })
3244
+
3245
+ It ("TSDecrByWithArgs" , func () {
3246
+ operationIntCmd (clientMock , func () * ExpectedInt {
3247
+ return clientMock .ExpectTSDecrByWithArgs ("key" , 2.0 , & redis.TSIncrDecrOptions {
3248
+ Retention : 1 ,
3249
+ ChunkSize : 1000 ,
3250
+ })
3251
+ }, func () * redis.IntCmd {
3252
+ return client .TSDecrByWithArgs (ctx , "key" , 2.0 , & redis.TSIncrDecrOptions {
3253
+ Retention : 1 ,
3254
+ ChunkSize : 1000 ,
3255
+ })
3256
+ })
3257
+ })
3258
+
3259
+ It ("TSDel" , func () {
3260
+ operationIntCmd (clientMock , func () * ExpectedInt {
3261
+ return clientMock .ExpectTSDel ("key" , 0 , 1 )
3262
+ }, func () * redis.IntCmd {
3263
+ return client .TSDel (ctx , "key" , 0 , 1 )
3264
+ })
3265
+ })
3266
+
3267
+ It ("TSDeleteRule" , func () {
3268
+ operationStatusCmd (clientMock , func () * ExpectedStatus {
3269
+ return clientMock .ExpectTSDeleteRule ("sourceKey" , "destKey" )
3270
+ }, func () * redis.StatusCmd {
3271
+ return client .TSDeleteRule (ctx , "sourceKey" , "destKey" )
3272
+ })
3273
+ })
3274
+
3275
+ It ("TSGet" , func () {
3276
+ operationTSTimestampValueCmd (clientMock , func () * ExpectedTSTimestampValue {
3277
+ return clientMock .ExpectTSGet ("key" )
3278
+ }, func () * redis.TSTimestampValueCmd {
3279
+ return client .TSGet (ctx , "key" )
3280
+ })
3281
+ })
3282
+
3283
+ It ("TSGetWithArgs" , func () {
3284
+ operationTSTimestampValueCmd (clientMock , func () * ExpectedTSTimestampValue {
3285
+ return clientMock .ExpectTSGetWithArgs ("key" , & redis.TSGetOptions {
3286
+ Latest : true ,
3287
+ })
3288
+ }, func () * redis.TSTimestampValueCmd {
3289
+ return client .TSGetWithArgs (ctx , "key" , & redis.TSGetOptions {
3290
+ Latest : true ,
3291
+ })
3292
+ })
3293
+ })
3294
+
3295
+ It ("TSInfo" , func () {
3296
+ operationMapStringInterfaceCmd (clientMock , func () * ExpectedMapStringInterface {
3297
+ return clientMock .ExpectTSInfo ("key" )
3298
+ }, func () * redis.MapStringInterfaceCmd {
3299
+ return client .TSInfo (ctx , "key" )
3300
+ })
3301
+ })
3302
+
3303
+ It ("TSInfoWithArgs" , func () {
3304
+ operationMapStringInterfaceCmd (clientMock , func () * ExpectedMapStringInterface {
3305
+ return clientMock .ExpectTSInfoWithArgs ("key" , & redis.TSInfoOptions {
3306
+ Debug : true ,
3307
+ })
3308
+ }, func () * redis.MapStringInterfaceCmd {
3309
+ return client .TSInfoWithArgs (ctx , "key" , & redis.TSInfoOptions {
3310
+ Debug : true ,
3311
+ })
3312
+ })
3313
+ })
3314
+
3315
+ It ("TSMAdd" , func () {
3316
+ operationIntSliceCmd (clientMock , func () * ExpectedIntSlice {
3317
+ return clientMock .ExpectTSMAdd ([][]interface {}{{"key" , 1 , "value" }})
3318
+ }, func () * redis.IntSliceCmd {
3319
+ return client .TSMAdd (ctx , [][]interface {}{{"key" , 1 , "value" }})
3320
+ })
3321
+ })
3322
+
3323
+ It ("TSQueryIndex" , func () {
3324
+ operationStringSliceCmd (clientMock , func () * ExpectedStringSlice {
3325
+ return clientMock .ExpectTSQueryIndex ([]string {"filterExpr" })
3326
+ }, func () * redis.StringSliceCmd {
3327
+ return client .TSQueryIndex (ctx , []string {"filterExpr" })
3328
+ })
3329
+ })
3330
+
3331
+ It ("TSRevRange" , func () {
3332
+ operationTSTimestampValueSliceCmd (clientMock , func () * ExpectedTSTimestampValueSlice {
3333
+ return clientMock .ExpectTSRevRange ("key" , 1 , 2 )
3334
+ }, func () * redis.TSTimestampValueSliceCmd {
3335
+ return client .TSRevRange (ctx , "key" , 1 , 2 )
3336
+ })
3337
+ })
3338
+
3339
+ It ("TSRevRangeWithArgs" , func () {
3340
+ operationTSTimestampValueSliceCmd (clientMock , func () * ExpectedTSTimestampValueSlice {
3341
+ return clientMock .ExpectTSRevRangeWithArgs ("key" , 1 , 2 , & redis.TSRevRangeOptions {
3342
+ Latest : true ,
3343
+ Count : 10 ,
3344
+ })
3345
+ }, func () * redis.TSTimestampValueSliceCmd {
3346
+ return client .TSRevRangeWithArgs (ctx , "key" , 1 , 2 , & redis.TSRevRangeOptions {
3347
+ Latest : true ,
3348
+ Count : 10 ,
3349
+ })
3350
+ })
3351
+ })
3352
+
3353
+ It ("TSRange" , func () {
3354
+ operationTSTimestampValueSliceCmd (clientMock , func () * ExpectedTSTimestampValueSlice {
3355
+ return clientMock .ExpectTSRange ("key" , 1 , 2 )
3356
+ }, func () * redis.TSTimestampValueSliceCmd {
3357
+ return client .TSRange (ctx , "key" , 1 , 2 )
3358
+ })
3359
+ })
3360
+
3361
+ It ("TSRangeWithArgs" , func () {
3362
+ operationTSTimestampValueSliceCmd (clientMock , func () * ExpectedTSTimestampValueSlice {
3363
+ return clientMock .ExpectTSRangeWithArgs ("key" , 1 , 2 , & redis.TSRangeOptions {
3364
+ Latest : true ,
3365
+ Count : 10 ,
3366
+ })
3367
+ }, func () * redis.TSTimestampValueSliceCmd {
3368
+ return client .TSRangeWithArgs (ctx , "key" , 1 , 2 , & redis.TSRangeOptions {
3369
+ Latest : true ,
3370
+ Count : 10 ,
3371
+ })
3372
+ })
3373
+ })
3374
+
3375
+ It ("TSMRange" , func () {
3376
+ operationMapStringSliceInterfaceCmd (clientMock , func () * ExpectedMapStringSliceInterface {
3377
+ return clientMock .ExpectTSMRange (1 , 2 , []string {"filterExpr" })
3378
+ }, func () * redis.MapStringSliceInterfaceCmd {
3379
+ return client .TSMRange (ctx , 1 , 2 , []string {"filterExpr" })
3380
+ })
3381
+ })
3382
+
3383
+ It ("TSMRangeWithArgs" , func () {
3384
+ operationMapStringSliceInterfaceCmd (clientMock , func () * ExpectedMapStringSliceInterface {
3385
+ return clientMock .ExpectTSMRangeWithArgs (1 , 2 , []string {"filterExpr" }, & redis.TSMRangeOptions {
3386
+ Latest : true ,
3387
+ Count : 10 ,
3388
+ })
3389
+ }, func () * redis.MapStringSliceInterfaceCmd {
3390
+ return client .TSMRangeWithArgs (ctx , 1 , 2 , []string {"filterExpr" }, & redis.TSMRangeOptions {
3391
+ Latest : true ,
3392
+ Count : 10 ,
3393
+ })
3394
+ })
3395
+ })
3396
+
3397
+ It ("TSMRevRange" , func () {
3398
+ operationMapStringSliceInterfaceCmd (clientMock , func () * ExpectedMapStringSliceInterface {
3399
+ return clientMock .ExpectTSMRevRange (1 , 2 , []string {"filterExpr" })
3400
+ }, func () * redis.MapStringSliceInterfaceCmd {
3401
+ return client .TSMRevRange (ctx , 1 , 2 , []string {"filterExpr" })
3402
+ })
3403
+ })
3404
+
3405
+ It ("TSMRevRangeWithArgs" , func () {
3406
+ operationMapStringSliceInterfaceCmd (clientMock , func () * ExpectedMapStringSliceInterface {
3407
+ return clientMock .ExpectTSMRevRangeWithArgs (1 , 2 , []string {"filterExpr" }, & redis.TSMRevRangeOptions {
3408
+ Latest : true ,
3409
+ Count : 10 ,
3410
+ })
3411
+ }, func () * redis.MapStringSliceInterfaceCmd {
3412
+ return client .TSMRevRangeWithArgs (ctx , 1 , 2 , []string {"filterExpr" }, & redis.TSMRevRangeOptions {
3413
+ Latest : true ,
3414
+ Count : 10 ,
3415
+ })
3416
+ })
3417
+ })
3418
+
3419
+ It ("TSMGet" , func () {
3420
+ operationMapStringSliceInterfaceCmd (clientMock , func () * ExpectedMapStringSliceInterface {
3421
+ return clientMock .ExpectTSMGet ([]string {"filter" })
3422
+ }, func () * redis.MapStringSliceInterfaceCmd {
3423
+ return client .TSMGet (ctx , []string {"filter" })
3424
+ })
3425
+ })
3426
+
3427
+ It ("TSMGetWithArgs" , func () {
3428
+ operationMapStringSliceInterfaceCmd (clientMock , func () * ExpectedMapStringSliceInterface {
3429
+ return clientMock .ExpectTSMGetWithArgs ([]string {"filter" }, & redis.TSMGetOptions {
3430
+ Latest : true ,
3431
+ WithLabels : true ,
3432
+ SelectedLabels : []interface {}{"label1" , "label2" , 100 },
3433
+ })
3434
+ }, func () * redis.MapStringSliceInterfaceCmd {
3435
+ return client .TSMGetWithArgs (ctx , []string {"filter" }, & redis.TSMGetOptions {
3436
+ Latest : true ,
3437
+ WithLabels : true ,
3438
+ SelectedLabels : []interface {}{"label1" , "label2" , 100 },
3439
+ })
3440
+ })
3441
+ })
3138
3442
}
3139
3443
3140
3444
Describe ("client" , func () {
0 commit comments