You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Adding a RedisTimeSeries example (#1839)
* Adds the start of a timeseries example. * Exports required TimeSeries items. * Fixed import. * Added TS.INFO example output. * Fixed typo. * Fixed typo. * Exported aggregation enum. * Working time series example. Co-authored-by: Leibale Eidelman <leibale1998@gmail.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import { transformArguments } from './CREATERULE';
|
||||
describe('CREATERULE', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('source', 'destination', TimeSeriesAggregationType.AVARAGE, 1),
|
||||
transformArguments('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
|
||||
['TS.CREATERULE', 'source', 'destination', 'AGGREGATION', 'avg', '1']
|
||||
);
|
||||
});
|
||||
@@ -18,7 +18,7 @@ describe('CREATERULE', () => {
|
||||
]);
|
||||
|
||||
assert.equal(
|
||||
await client.ts.createRule('source', 'destination', TimeSeriesAggregationType.AVARAGE, 1),
|
||||
await client.ts.createRule('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1),
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
@@ -15,7 +15,7 @@ describe('DELETERULE', () => {
|
||||
await Promise.all([
|
||||
client.ts.create('source'),
|
||||
client.ts.create('destination'),
|
||||
client.ts.createRule('source', 'destination', TimeSeriesAggregationType.AVARAGE, 1)
|
||||
client.ts.createRule('source', 'destination', TimeSeriesAggregationType.AVERAGE, 1)
|
||||
]);
|
||||
|
||||
assert.equal(
|
||||
|
@@ -15,7 +15,7 @@ describe('MRANGE', () => {
|
||||
COUNT: 1,
|
||||
ALIGN: '-',
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
},
|
||||
GROUPBY: {
|
||||
|
@@ -16,7 +16,7 @@ describe('MRANGE_WITHLABELS', () => {
|
||||
COUNT: 1,
|
||||
ALIGN: '-',
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
},
|
||||
GROUPBY: {
|
||||
|
@@ -15,7 +15,7 @@ describe('MREVRANGE', () => {
|
||||
COUNT: 1,
|
||||
ALIGN: '-',
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
},
|
||||
GROUPBY: {
|
||||
|
@@ -16,7 +16,7 @@ describe('MREVRANGE_WITHLABELS', () => {
|
||||
COUNT: 1,
|
||||
ALIGN: '-',
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
},
|
||||
GROUPBY: {
|
||||
|
@@ -15,7 +15,7 @@ describe('RANGE', () => {
|
||||
COUNT: 1,
|
||||
ALIGN: '-',
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
}
|
||||
}),
|
||||
|
@@ -55,7 +55,7 @@ describe('REVRANGE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments('key', '-', '+', {
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
}
|
||||
}),
|
||||
@@ -74,7 +74,7 @@ describe('REVRANGE', () => {
|
||||
COUNT: 1,
|
||||
ALIGN: '-',
|
||||
AGGREGATION: {
|
||||
type: TimeSeriesAggregationType.AVARAGE,
|
||||
type: TimeSeriesAggregationType.AVERAGE,
|
||||
timeBucket: 1
|
||||
}
|
||||
}),
|
||||
|
@@ -68,7 +68,7 @@ export default {
|
||||
};
|
||||
|
||||
export enum TimeSeriesAggregationType {
|
||||
AVARAGE = 'avg',
|
||||
AVERAGE = 'avg',
|
||||
SUM = 'sum',
|
||||
MINIMUM = 'min',
|
||||
MAXIMUM = 'max',
|
||||
|
Reference in New Issue
Block a user