1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Refactor command parsing

This commit is contained in:
Ruben Bridgewater
2016-05-27 17:32:42 +02:00
parent 899f9b7fe4
commit 8b6f2dd35e
10 changed files with 106 additions and 123 deletions

View File

@@ -3,6 +3,7 @@
var commands = require('redis-commands');
var Multi = require('./multi');
var RedisClient = require('../').RedisClient;
var Command = require('./command');
// TODO: Rewrite this including the invidual commands into a Commands class
// that provided a functionality to add new commands to the client
@@ -42,7 +43,7 @@ commands.list.forEach(function (command) {
arr[i] = arguments[i];
}
}
return this.internal_send_command(command, arr, callback);
return this.internal_send_command(new Command(command, arr, callback));
};
Object.defineProperty(RedisClient.prototype[command], 'name', {
value: command
@@ -82,7 +83,7 @@ commands.list.forEach(function (command) {
arr[i] = arguments[i];
}
}
this.queue.push([command, arr, callback]);
this.queue.push(new Command(command, arr, callback));
return this;
};
Object.defineProperty(Multi.prototype[command], 'name', {