You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
31 lines
885 B
TypeScript
31 lines
885 B
TypeScript
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
|
import { RedisVariadicArgument, pushVariadicArgument } from '@redis/client/dist/lib/commands/generic-transformers';
|
|
|
|
export interface TDigestMergeOptions {
|
|
COMPRESSION?: number;
|
|
OVERRIDE?: boolean;
|
|
}
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: undefined,
|
|
IS_READ_ONLY: false,
|
|
transformArguments(
|
|
destination: RedisArgument,
|
|
source: RedisVariadicArgument,
|
|
options?: TDigestMergeOptions
|
|
) {
|
|
const args = pushVariadicArgument(['TDIGEST.MERGE', destination], source);
|
|
|
|
if (options?.COMPRESSION !== undefined) {
|
|
args.push('COMPRESSION', options.COMPRESSION.toString());
|
|
}
|
|
|
|
if (options?.OVERRIDE) {
|
|
args.push('OVERRIDE');
|
|
}
|
|
|
|
return args;
|
|
},
|
|
transformReply: undefined as unknown as () => SimpleStringReply<'OK'>
|
|
} as const satisfies Command;
|