mirror of
https://github.com/qishibo/AnotherRedisDesktopManager.git
synced 2026-01-18 16:12:43 +00:00
27 lines
577 B
JavaScript
27 lines
577 B
JavaScript
export default {
|
|
message: {
|
|
catchError: '(error) Operate failed',
|
|
clientEmpty: 'Redis Client Is Not Yet',
|
|
unknownCommand: '(error) ERR unknown command',
|
|
},
|
|
|
|
exec(client, params = []) {
|
|
if (!client) {
|
|
return this.message.clientEmpty;
|
|
}
|
|
|
|
const operation = params[0] ? params[0].toLowerCase() : '';
|
|
|
|
return new Promise((resolve, reject) => {
|
|
client.callBuffer(operation, params.slice(1), (err, reply) => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
else {
|
|
resolve(reply);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
};
|