You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types';
|
|
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
|
|
import { TsMRangeOptions, pushGroupByArgument } from './MRANGE';
|
|
import { Timestamp, pushWithLabelsArgument } from '.';
|
|
import { pushFilterArgument } from './MGET';
|
|
import { pushRangeArguments } from './RANGE';
|
|
|
|
export interface TsMRangeWithLabelsOptions extends TsMRangeOptions {
|
|
SELECTED_LABELS?: RedisVariadicArgument;
|
|
}
|
|
|
|
export function transformMRangeWithLabelsArguments(
|
|
command: RedisArgument,
|
|
fromTimestamp: Timestamp,
|
|
toTimestamp: Timestamp,
|
|
filter: RedisVariadicArgument,
|
|
options?: TsMRangeWithLabelsOptions
|
|
) {
|
|
let args = pushRangeArguments([command], fromTimestamp, toTimestamp, options);
|
|
args = pushWithLabelsArgument(args, options?.SELECTED_LABELS);
|
|
args = pushFilterArgument(args, filter);
|
|
return pushGroupByArgument(args, options?.GROUPBY);
|
|
}
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: undefined,
|
|
IS_READ_ONLY: true,
|
|
transformArguments: transformMRangeWithLabelsArguments.bind(undefined, 'TS.MRANGE'),
|
|
// TODO
|
|
transformReply: undefined as unknown as () => any
|
|
} as const satisfies Command;
|