redis-time-series-ts
Version:
Javascript RedisTimeSeries client
34 lines (33 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CommandProvider = void 0;
const commandName_1 = require("../enum/commandName");
class CommandProvider {
constructor(redisClient) {
this.client = redisClient;
this.commands = {};
this.buildCommands();
}
getCommand(commandName) {
return this.commands[commandName];
}
getCommandData(commandName, params) {
return {
commandName: commandName,
commandFunction: this.getCommand(commandName),
commandParams: params
};
}
getRTSClient() {
return this.client;
}
buildCommands() {
for (const key in commandName_1.CommandName) {
const command = commandName_1.CommandName[key];
const redisCommand = this.client.createBuiltinCommand(command);
// @ts-ignore
this.commands[command] = redisCommand.string;
}
}
}
exports.CommandProvider = CommandProvider;