mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Merge pull request #30338 from tingwai-to/master
[ioredis] Add types for Redis Streams commands
This commit is contained in:
commit
70c1fe819a
53
types/ioredis/index.d.ts
vendored
53
types/ioredis/index.d.ts
vendored
@ -9,6 +9,7 @@
|
||||
// Francis Gulotta <https://github.com/reconbot>
|
||||
// Dmitry Motovilov <https://github.com/funthing>
|
||||
// Oleg Repin <https://github.com/iamolegga>
|
||||
// Ting-Wai To <https://github.com/tingwai-to>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@ -482,6 +483,32 @@ declare namespace IORedis {
|
||||
sscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter;
|
||||
hscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter;
|
||||
zscanStream(key: KeyType, options?: ScanStreamOption): NodeJS.EventEmitter;
|
||||
|
||||
xack(key: KeyType, group: string, ...ids: string[]): any;
|
||||
|
||||
xadd(key: KeyType, id: string, ...args: string[]): any;
|
||||
|
||||
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, ...args: any[]): any;
|
||||
|
||||
xdel(key: KeyType, ...ids: string[]): any;
|
||||
|
||||
xgroup(...args: any[]): any;
|
||||
|
||||
xinfo(...args: any[]): any;
|
||||
|
||||
xlen(key: KeyType): any;
|
||||
|
||||
xpending(key: KeyType, group: string, ...args: any[]): any;
|
||||
|
||||
xrange(key: KeyType, start: string, end: string, ...args: any[]): any;
|
||||
|
||||
xread(...args: any[]): any;
|
||||
|
||||
xreadgroup(groupOption: 'GROUP' | 'group', group: string, consumer: string, ...args: any[]): any;
|
||||
|
||||
xrevrange(key: KeyType, end: string, start: string, ...args: any[]): any;
|
||||
|
||||
xtrim(key: KeyType, maxLenOption: 'MAXLEN' | 'maxlen', ...args: any[]): any;
|
||||
}
|
||||
|
||||
interface Pipeline {
|
||||
@ -801,6 +828,32 @@ declare namespace IORedis {
|
||||
pfadd(key: KeyType, ...elements: string[]): Pipeline;
|
||||
|
||||
pfcount(...keys: KeyType[]): Pipeline;
|
||||
|
||||
xack(key: KeyType, group: string, ...ids: string[]): Pipeline;
|
||||
|
||||
xadd(key: KeyType, id: string, ...args: string[]): Pipeline;
|
||||
|
||||
xclaim(key: KeyType, group: string, consumer: string, minIdleTime: number, id: string, ...args: any[]): Pipeline;
|
||||
|
||||
xdel(key: KeyType, ...ids: string[]): Pipeline;
|
||||
|
||||
xgroup(...args: any[]): Pipeline;
|
||||
|
||||
xinfo(...args: any[]): Pipeline;
|
||||
|
||||
xlen(key: KeyType): Pipeline;
|
||||
|
||||
xpending(key: KeyType, group: string, ...args: any[]): Pipeline;
|
||||
|
||||
xrange(key: KeyType, start: string, end: string, ...args: any[]): Pipeline;
|
||||
|
||||
xread(...args: any[]): Pipeline;
|
||||
|
||||
xreadgroup(command: 'GROUP' | 'group', group: string, consumer: string, ...args: any[]): Pipeline;
|
||||
|
||||
xrevrange(key: KeyType, end: string, start: string, ...args: any[]): Pipeline;
|
||||
|
||||
xtrim(key: KeyType, strategy: 'MAXLEN' | 'maxlen', ...args: any[]): Pipeline;
|
||||
}
|
||||
|
||||
interface NodeConfiguration {
|
||||
|
||||
@ -173,3 +173,22 @@ new Redis.Cluster([{
|
||||
host: 'localhost',
|
||||
port: 6379
|
||||
}]);
|
||||
|
||||
redis.xack('streamName', 'groupName', 'id');
|
||||
redis.xadd('streamName', '*', 'field', 'name');
|
||||
redis.xclaim('streamName', 'groupName', 'consumerName', 3600000, 'id');
|
||||
redis.xdel('streamName', 'id');
|
||||
redis.xgroup('CREATE', 'streamName', 'groupName', '$');
|
||||
redis.xgroup('SETUP', 'streamName', 'groupName', '$');
|
||||
redis.xgroup('DESTROY', 'streamName', 'groupName');
|
||||
redis.xgroup('DELCONSUMER', 'streamName', 'groupName', 'consumerName');
|
||||
redis.xinfo('CONSUMERS', 'streamName', 'groupName');
|
||||
redis.xinfo('GROUPS', 'streamName');
|
||||
redis.xinfo('STREAM', 'streamName');
|
||||
redis.xlen('streamName');
|
||||
redis.xpending('streamName', 'groupName', '-', '+', '10', 'consumerName');
|
||||
redis.xrange('streamName', '-', '+', 'COUNT', 1);
|
||||
redis.xread('STREAMS', 'streamName', '0-0');
|
||||
redis.xreadgroup('GROUP', 'groupName', 'consumerName', 'STREAMS', 'streamName', '>');
|
||||
redis.xrevrange('streamName', '+', '-', 'COUNT', 1);
|
||||
redis.xtrim('streamName', 'MAXLEN', '~', 1000);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user