1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
2023-05-02 20:02:03 -04:00

26 lines
613 B
TypeScript

import { RedisArgument, NumberReply, Command } from '../RESP/types';
export interface CopyCommandOptions {
DB?: number;
REPLACE?: boolean;
}
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: false,
transformArguments(source: RedisArgument, destination: RedisArgument, options?: CopyCommandOptions) {
const args = ['COPY', source, destination];
if (options?.DB) {
args.push('DB', options.DB.toString());
}
if (options?.REPLACE) {
args.push('REPLACE');
}
return args;
},
transformReply: undefined as unknown as () => NumberReply
} as const satisfies Command;