add redis add_command function

This commit is contained in:
43081j
2017-12-01 15:41:30 +00:00
parent b4855506d3
commit 809dbe9864
3 changed files with 15 additions and 7 deletions

View File

@@ -5,6 +5,7 @@
// TANAKA Koichi <https://github.com/MugeSo>
// Stuart Schechter <https://github.com/UppaJung>
// Junyoung Choi <https://github.com/Rokt33r>
// James Garbutt <https://github.com/43081j>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/types/npm-redis
@@ -43,7 +44,7 @@ export interface ClientOpts {
password?: string;
db?: string | number;
family?: string;
rename_commands?: { [command: string]: string };
rename_commands?: { [command: string]: string } | null;
tls?: any;
prefix?: string;
retry_strategy?: RetryStrategy;
@@ -1202,6 +1203,9 @@ export interface RedisClient extends Commands<boolean>, EventEmitter {
send_command(command: string, cb?: Callback<any>): boolean;
send_command(command: string, args?: any[], cb?: Callback<any>): boolean;
addCommand(command: string): void;
add_command(command: string): void;
/**
* Mark the start of a transaction block.
*/

View File

@@ -6,10 +6,10 @@ const num = 0;
const str = 'any string';
const err: Error = new Error();
const args: any[] = [];
const resCallback: (err: Error, res: any) => void = () => null;
const numCallback: (err: Error, res: number) => void = () => null;
const strCallback: (err: Error, res: string) => void = () => null;
const messageHandler: (channel: string, message: any) => void = () => null;
const resCallback: (err: Error | null, res: any) => void = () => {};
const numCallback: (err: Error | null, res: number) => void = () => {};
const strCallback: (err: Error | null, res: string) => void = () => {};
const messageHandler: (channel: string, message: any) => void = () => {};
// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
@@ -117,3 +117,7 @@ client.cork();
client.set("abc", "fff", strCallback);
client.get("abc", resCallback);
client.uncork();
// Add command
client.add_command('my command');
client.addCommand('my other command');

View File

@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -20,4 +20,4 @@
"index.d.ts",
"redis-tests.ts"
]
}
}