You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
* (docs) bloom: add jsdocs for all commands * (docs) json: add jsdocs * (docs) search: add jsdocs for all commands * (docs) jsdocs for std commands * (docs) jsdoc comments to time series commands
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { CommandParser } from '@redis/client/dist/lib/client/parser';
|
|
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
|
import { RedisVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
|
|
|
|
export interface TDigestMergeOptions {
|
|
COMPRESSION?: number;
|
|
OVERRIDE?: boolean;
|
|
}
|
|
|
|
export default {
|
|
IS_READ_ONLY: false,
|
|
/**
|
|
* Merges multiple t-digest sketches into one, with optional compression and override settings
|
|
* @param parser - The command parser
|
|
* @param destination - The name of the destination t-digest sketch
|
|
* @param source - One or more source sketch names to merge from
|
|
* @param options - Optional parameters for merge operation
|
|
* @param options.COMPRESSION - New compression value for merged sketch
|
|
* @param options.OVERRIDE - If true, override destination sketch if it exists
|
|
*/
|
|
parseCommand(
|
|
parser: CommandParser,
|
|
destination: RedisArgument,
|
|
source: RedisVariadicArgument,
|
|
options?: TDigestMergeOptions
|
|
) {
|
|
parser.push('TDIGEST.MERGE');
|
|
parser.pushKey(destination);
|
|
parser.pushKeysLength(source);
|
|
|
|
if (options?.COMPRESSION !== undefined) {
|
|
parser.push('COMPRESSION', options.COMPRESSION.toString());
|
|
}
|
|
|
|
if (options?.OVERRIDE) {
|
|
parser.push('OVERRIDE');
|
|
}
|
|
},
|
|
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
|
} as const satisfies Command;
|