You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
fix CREATERULE
This commit is contained in:
@@ -1,20 +1,20 @@
|
|||||||
import { strict as assert } from 'assert';
|
import { strict as assert } from 'assert';
|
||||||
import { TimeSeriesAggregationType } from '.';
|
import { TimeSeriesAggregationType } from '.';
|
||||||
import testUtils, { GLOBAL } from '../test-utils';
|
import testUtils, { GLOBAL } from '../test-utils';
|
||||||
import { transformArguments } from './CREATERULE';
|
import CREATERULE from './CREATERULE';
|
||||||
|
|
||||||
describe('CREATERULE', () => {
|
describe('CREATERULE', () => {
|
||||||
describe('transformArguments', () => {
|
describe('transformArguments', () => {
|
||||||
it('without options', () => {
|
it('without options', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
|
CREATERULE.transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
|
||||||
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1']
|
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('with alignTimestamp', () => {
|
it('with alignTimestamp', () => {
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1, 1),
|
CREATERULE.transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1, 1),
|
||||||
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1', '1']
|
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'AVG', '1', '1']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -1,14 +1,16 @@
|
|||||||
import { TimeSeriesAggregationType } from '.';
|
import { TimeSeriesAggregationType } from '.';
|
||||||
|
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||||
|
|
||||||
export const FIRST_KEY_INDEX = 1;
|
export default {
|
||||||
|
FIRST_KEY_INDEX: 1,
|
||||||
export function transformArguments(
|
IS_READ_ONLY: false,
|
||||||
sourceKey: string,
|
transformArguments(
|
||||||
destinationKey: string,
|
sourceKey: RedisArgument,
|
||||||
|
destinationKey: RedisArgument,
|
||||||
aggregationType: TimeSeriesAggregationType,
|
aggregationType: TimeSeriesAggregationType,
|
||||||
bucketDuration: number,
|
bucketDuration: number,
|
||||||
alignTimestamp?: number
|
alignTimestamp?: number
|
||||||
): Array<string> {
|
) {
|
||||||
const args = [
|
const args = [
|
||||||
'TS.CREATERULE',
|
'TS.CREATERULE',
|
||||||
sourceKey,
|
sourceKey,
|
||||||
@@ -23,6 +25,6 @@ export function transformArguments(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return args;
|
return args;
|
||||||
}
|
},
|
||||||
|
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
||||||
export declare function transformReply(): 'OK';
|
} as const satisfies Command;
|
||||||
|
Reference in New Issue
Block a user