You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
init time series
This commit is contained in:
42
packages/time-series/lib/commands/CREATE.ts
Normal file
42
packages/time-series/lib/commands/CREATE.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
pushRetentionArgument,
|
||||
TimeSeriesEncoding,
|
||||
pushEncodingArgument,
|
||||
pushChunkSizeArgument,
|
||||
TimeSeriesDuplicatePolicies,
|
||||
Labels,
|
||||
pushLabelsArgument
|
||||
} from '.';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
interface CreateOptions {
|
||||
RETENTION?: number;
|
||||
ENCODING?: TimeSeriesEncoding;
|
||||
CHUNK_SIZE?: number;
|
||||
DUPLICATE_POLICY?: TimeSeriesDuplicatePolicies;
|
||||
LABELS?: Labels;
|
||||
}
|
||||
|
||||
export function transformArguments(key: string, options?: CreateOptions): Array<string> {
|
||||
const args = ['TS.CREATE', key];
|
||||
|
||||
pushRetentionArgument(args, options?.RETENTION);
|
||||
|
||||
pushEncodingArgument(args, options?.ENCODING);
|
||||
|
||||
pushChunkSizeArgument(args, options?.CHUNK_SIZE);
|
||||
|
||||
if (options?.DUPLICATE_POLICY) {
|
||||
args.push(
|
||||
'DUPLICATE_POLICY',
|
||||
options.DUPLICATE_POLICY
|
||||
);
|
||||
}
|
||||
|
||||
pushLabelsArgument(args, options?.LABELS);
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): 'OK';
|
Reference in New Issue
Block a user