You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
review
This commit is contained in:
@@ -4,11 +4,11 @@ import { transformArguments } from './MSET';
|
||||
|
||||
describe('MSET', () => {
|
||||
testUtils.isVersionGreaterThanHook([2, 6]);
|
||||
|
||||
|
||||
describe('transformArguments', () => {
|
||||
it('transformArguments', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments([{ key: "key", path: "$", value: "json" }, { key: "key2", path: "$", value: "json2" }]),
|
||||
transformArguments([{ key: 'key', path: '$', value: 'json' }, { key: 'key2', path: '$', value: 'json2' }]),
|
||||
['JSON.MSET', 'key', '$', '"json"', 'key2', '$', '"json2"']
|
||||
);
|
||||
});
|
||||
@@ -21,4 +21,4 @@ describe('MSET', () => {
|
||||
'OK'
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
});
|
||||
|
@@ -1,19 +1,16 @@
|
||||
import { RedisJSON, transformRedisJsonArgument } from '.';
|
||||
import { RedisJSON, transformRedisJsonArgument} from '.';
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export interface KeyPathValue {
|
||||
key: string;
|
||||
key: RedisCommandArgument;
|
||||
path: string;
|
||||
value: RedisJSON;
|
||||
}
|
||||
|
||||
export function transformArguments(keyPathValues: Array<KeyPathValue>): Array<string> {
|
||||
if (keyPathValues.length === 0) {
|
||||
throw new Error('ERR wrong number of arguments for \'MSET\' command');
|
||||
}
|
||||
|
||||
const args: string[] = ['JSON.MSET'];
|
||||
export function transformArguments(keyPathValues: Array<KeyPathValue>): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = ['JSON.MSET'];
|
||||
|
||||
keyPathValues.forEach(({ key, path, value }) => {
|
||||
args.push(key, path, transformRedisJsonArgument(value));
|
||||
@@ -22,4 +19,4 @@ export function transformArguments(keyPathValues: Array<KeyPathValue>): Array<st
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): 'OK' | null;
|
||||
export declare function transformReply(): 'OK';
|
||||
|
Reference in New Issue
Block a user