redis-time-series-ts
Version:
Javascript RedisTimeSeries client
33 lines • 1.18 kB
TypeScript
import { StringNumberArray } from "../index";
/**
* A `aggregation-type`-`timeBucket` object
*/
export declare class Aggregation {
private readonly type;
private readonly timeBucketInMs;
/**
* Creates a new Aggregation object
*
* @param type The type of aggregation e.g. AggregationType.AVG | AggregationType.SUM etc
* @param timeBucketInMs The time bucket for the aggregation
*
* @remarks
* // Example
* ```
* const aggregation = new Aggregation(AggregationType.AVG, 1000);
* const timestampRange = new TimestampRange(date, date + 10000);
* const samples = await redisTimeSeries.range("range1", timestampRange, undefined, aggregation);
*
* aggregation.getType() // avg
* aggregation.getTimeBucketInMs() // 1000
* aggregation.flatten() // ['AGGREGATION', 'avg', 1000]
* ```
*/
constructor(type: string, timeBucketInMs: number);
getType(): string;
getTimeBucketInMs(): number;
flatten(): StringNumberArray;
protected validateType(type: string): string;
protected validateTimeBucket(timeBucketInMs: number): number;
}
//# sourceMappingURL=aggregation.d.ts.map