1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/client/lib/commands/COPY.ts
2021-12-20 14:47:51 -05:00

29 lines
671 B
TypeScript

import { RedisCommandArgument, RedisCommandArguments } from '.';
interface CopyCommandOptions {
destinationDb?: number;
replace?: boolean;
}
export const FIRST_KEY_INDEX = 1;
export function transformArguments(
source: RedisCommandArgument,
destination: RedisCommandArgument,
options?: CopyCommandOptions
): RedisCommandArguments {
const args = ['COPY', source, destination];
if (options?.destinationDb) {
args.push('DB', options.destinationDb.toString());
}
if (options?.replace) {
args.push('REPLACE');
}
return args;
}
export { transformBooleanReply as transformReply } from './generic-transformers';