You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
WIP
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
`String` -> `Double`:
|
||||
- `INCRBYFLOAT`
|
||||
- `HINCRBYFLOAT`
|
||||
- `GEODIST`
|
||||
|
||||
`Number` -> `Boolean`:
|
||||
- `HSETNX` (deprecated)
|
||||
|
@@ -45,6 +45,20 @@ Rather than using `client.quit()`, your code should use `client.close()` or `cli
|
||||
|
||||
TODO difference between `close` and `disconnect`...
|
||||
|
||||
## Scan Iterators
|
||||
|
||||
TODO
|
||||
|
||||
Yields chunks instead of individual items:
|
||||
|
||||
```javascript
|
||||
for await (const chunk of client.scanIterator()) {
|
||||
// `chunk` type is `Array<string>`
|
||||
// will allow multi keys operations
|
||||
await client.del(chunk);
|
||||
}
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
Some command arguments/replies have changed to align more closely to data types returned by Redis:
|
||||
@@ -69,6 +83,8 @@ Some command arguments/replies have changed to align more closely to data types
|
||||
- `HSCAN`: `tuples` has been renamed to `entries`
|
||||
- `PFADD`: `boolean` -> `number` [^boolean-to-number]
|
||||
- `SCRIPT EXISTS`: `Array<boolean>` -> `Array<number>` [^boolean-to-number]
|
||||
- `SISMEMBER`: `boolean` -> `number` [^boolean-to-number]
|
||||
- `SMISMEMBER`: `Array<boolean>` -> `Array<number>` [^boolean-to-number]
|
||||
|
||||
[^enum-to-constants]: TODO
|
||||
|
||||
|
@@ -12,13 +12,8 @@ import RedisClientMultiCommand, { RedisClientMultiCommandType } from './multi-co
|
||||
import { RedisMultiQueuedCommand } from '../multi-command';
|
||||
import HELLO, { HelloOptions } from '../commands/HELLO';
|
||||
import { Pool, Options as PoolOptions, createPool } from 'generic-pool';
|
||||
import { ReplyWithFlags, BlobStringReply } from '../RESP/types';
|
||||
import { ScanCommandOptions } from '../commands/SCAN';
|
||||
import { HScanEntry } from '../commands/HSCAN';
|
||||
import { ScanOptions, ZMember } from '../commands/generic-transformers';
|
||||
|
||||
|
||||
|
||||
import { ReplyWithFlags, CommandReply } from '../RESP/types';
|
||||
import SCAN, { ScanOptions, ScanCommonOptions } from '../commands/SCAN';
|
||||
|
||||
export interface RedisClientOptions<
|
||||
M extends RedisModules = RedisModules,
|
||||
@@ -538,7 +533,7 @@ export default class RedisClient<
|
||||
value: V
|
||||
) {
|
||||
const proxy = Object.create(this.self);
|
||||
proxy.commandOptions = Object.create((this as ProxyClient).commandOptions ?? null);
|
||||
proxy.commandOptions = Object.create((this as unknown as ProxyClient).commandOptions ?? null);
|
||||
proxy.commandOptions[key] = value;
|
||||
return proxy as RedisClientType<
|
||||
M,
|
||||
@@ -840,60 +835,52 @@ export default class RedisClient<
|
||||
|
||||
async* scanIterator(
|
||||
this: RedisClientType<M, F, S, RESP, FLAGS>,
|
||||
options?: ScanCommandOptions & ScanIteratorOptions
|
||||
): AsyncIterable<ReplyWithFlags<BlobStringReply, FLAGS>> {
|
||||
options?: ScanOptions & ScanIteratorOptions
|
||||
): AsyncIterable<ReplyWithFlags<CommandReply<typeof SCAN, RESP>['keys'], FLAGS>> {
|
||||
let cursor = options?.cursor ?? 0;
|
||||
do {
|
||||
const reply = await this.scan(cursor, options);
|
||||
cursor = reply.cursor;
|
||||
for (const key of reply.keys) {
|
||||
yield key;
|
||||
}
|
||||
yield reply.keys;
|
||||
} while (cursor !== 0);
|
||||
}
|
||||
|
||||
async* hScanIterator(
|
||||
this: RedisClientType<M, F, S, RESP, FLAGS>,
|
||||
key: RedisArgument,
|
||||
options?: ScanOptions & ScanIteratorOptions
|
||||
): AsyncIterable<ReplyWithFlags<HScanEntry, FLAGS>> {
|
||||
options?: ScanCommonOptions & ScanIteratorOptions
|
||||
) {
|
||||
let cursor = options?.cursor ?? 0;
|
||||
do {
|
||||
const reply = await this.hScan(key, cursor, options);
|
||||
cursor = reply.cursor;
|
||||
for (const entry of reply.entries) {
|
||||
yield entry;
|
||||
}
|
||||
yield reply.entries;
|
||||
} while (cursor !== 0);
|
||||
}
|
||||
|
||||
async* sScanIterator(
|
||||
this: RedisClientType<M, F, S, RESP, FLAGS>,
|
||||
key: RedisArgument,
|
||||
options?: ScanOptions & ScanIteratorOptions
|
||||
): AsyncIterable<ReplyWithFlags<BlobStringReply, FLAGS>> {
|
||||
options?: ScanCommonOptions & ScanIteratorOptions
|
||||
) {
|
||||
let cursor = options?.cursor ?? 0;
|
||||
do {
|
||||
const reply = await this.sScan(key, cursor, options);
|
||||
cursor = reply.cursor;
|
||||
for (const member of reply.members) {
|
||||
yield member;
|
||||
}
|
||||
yield reply.members;
|
||||
} while (cursor !== 0);
|
||||
}
|
||||
|
||||
async* zScanIterator(
|
||||
this: RedisClientType<M, F, S, RESP, FLAGS>,
|
||||
key: RedisArgument,
|
||||
options?: ScanOptions & ScanIteratorOptions
|
||||
): AsyncIterable<ReplyWithFlags<ZMember, FLAGS>> {
|
||||
options?: ScanCommonOptions & ScanIteratorOptions
|
||||
) {
|
||||
let cursor = options?.cursor ?? 0;
|
||||
do {
|
||||
const reply = await this.zScan(key, cursor, options);
|
||||
cursor = reply.cursor;
|
||||
for (const member of reply.members) {
|
||||
yield member;
|
||||
}
|
||||
yield reply.members;
|
||||
} while (cursor !== 0);
|
||||
}
|
||||
|
||||
|
@@ -326,7 +326,7 @@ export default class RedisCluster<
|
||||
value: V
|
||||
) {
|
||||
const proxy = Object.create(this);
|
||||
proxy.commandOptions = Object.create((this as ProxyCluster).commandOptions ?? null);
|
||||
proxy.commandOptions = Object.create((this as unknown as ProxyCluster).commandOptions ?? null);
|
||||
proxy.commandOptions[key] = value;
|
||||
return proxy as RedisClusterType<
|
||||
M,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { RedisArgument, Command } from '../RESP/types';
|
||||
import { transformLMPopArguments, LMPopOptions, ListSide } from './generic-transformers';
|
||||
import { Command } from '../RESP/types';
|
||||
import { transformLMPopArguments, LMPopOptions, ListSide, RedisVariadicArgument } from './generic-transformers';
|
||||
import LMPOP from './LMPOP';
|
||||
|
||||
export default {
|
||||
@@ -7,7 +7,7 @@ export default {
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
timeout: number,
|
||||
keys: RedisArgument | Array<RedisArgument>,
|
||||
keys: RedisVariadicArgument,
|
||||
side: ListSide,
|
||||
options?: LMPopOptions
|
||||
) {
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { BlobStringReply, NullReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(
|
||||
key: RedisArgument | Array<RedisArgument>,
|
||||
key: RedisVariadicArgument,
|
||||
timeout: number
|
||||
) {
|
||||
const args = pushVariadicArguments(['BRPOP'], key);
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
import BLPOP from './BLPOP';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(
|
||||
key: RedisArgument | Array<RedisArgument>,
|
||||
key: RedisVariadicArgument,
|
||||
timeout: number
|
||||
) {
|
||||
const args = pushVariadicArguments(['BRPOP'], key);
|
||||
|
@@ -1,34 +1,34 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { SortedSetSide, transformZMPopArguments, ZMPopOptions } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { SortedSetSide, transformZMPopArguments, ZMPopOptions } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 3;
|
||||
// export const FIRST_KEY_INDEX = 3;
|
||||
|
||||
export function transformArguments(
|
||||
timeout: number,
|
||||
keys: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||
side: SortedSetSide,
|
||||
options?: ZMPopOptions
|
||||
): RedisCommandArguments {
|
||||
return transformZMPopArguments(
|
||||
['BZMPOP', timeout.toString()],
|
||||
keys,
|
||||
side,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// timeout: number,
|
||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||
// side: SortedSetSide,
|
||||
// options?: ZMPopOptions
|
||||
// ): RedisCommandArguments {
|
||||
// return transformZMPopArguments(
|
||||
// ['BZMPOP', timeout.toString()],
|
||||
// keys,
|
||||
// side,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export { transformReply } from './ZMPOP';
|
||||
// export { transformReply } from './ZMPOP';
|
||||
|
||||
|
||||
import { Command } from '../RESP/types';
|
||||
import ZMPOP from './ZMPOP';
|
||||
// import { Command } from '../RESP/types';
|
||||
// import ZMPOP from './ZMPOP';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
FIRST_KEY_INDEX: 3,
|
||||
transformArguments() {
|
||||
return ['BZMPOP'];
|
||||
},
|
||||
transformReply: ZMPOP.transformReply
|
||||
} as const satisfies Command;
|
||||
// export default {
|
||||
// FIRST_KEY_INDEX: 3,
|
||||
// IS_READ_ONLY: false,
|
||||
// transformArguments() {
|
||||
// return ['BZMPOP'];
|
||||
// },
|
||||
// transformReply: ZMPOP.transformReply
|
||||
// } as const satisfies Command;
|
||||
|
||||
|
@@ -1,29 +1,29 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments, transformNumberInfinityReply, ZMember } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments, transformDoubleReply, ZMember } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||
timeout: number
|
||||
): RedisCommandArguments {
|
||||
const args = pushVariadicArguments(['BZPOPMAX'], key);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||
// timeout: number
|
||||
// ): RedisCommandArguments {
|
||||
// const args = pushVariadicArguments(['BZPOPMAX'], key);
|
||||
|
||||
args.push(timeout.toString());
|
||||
// args.push(timeout.toString());
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
type ZMemberRawReply = [key: RedisCommandArgument, value: RedisCommandArgument, score: RedisCommandArgument] | null;
|
||||
// type ZMemberRawReply = [key: RedisCommandArgument, value: RedisCommandArgument, score: RedisCommandArgument] | null;
|
||||
|
||||
type BZPopMaxReply = (ZMember & { key: RedisCommandArgument }) | null;
|
||||
// type BZPopMaxReply = (ZMember & { key: RedisCommandArgument }) | null;
|
||||
|
||||
export function transformReply(reply: ZMemberRawReply): BZPopMaxReply | null {
|
||||
if (!reply) return null;
|
||||
// export function transformReply(reply: ZMemberRawReply): BZPopMaxReply | null {
|
||||
// if (!reply) return null;
|
||||
|
||||
return {
|
||||
key: reply[0],
|
||||
value: reply[1],
|
||||
score: transformNumberInfinityReply(reply[2])
|
||||
};
|
||||
}
|
||||
// return {
|
||||
// key: reply[0],
|
||||
// value: reply[1],
|
||||
// score: transformDoubleReply(reply[2])
|
||||
// };
|
||||
// }
|
||||
|
@@ -1,17 +1,17 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||
timeout: number
|
||||
): RedisCommandArguments {
|
||||
const args = pushVariadicArguments(['BZPOPMIN'], key);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument | Array<RedisCommandArgument>,
|
||||
// timeout: number
|
||||
// ): RedisCommandArguments {
|
||||
// const args = pushVariadicArguments(['BZPOPMIN'], key);
|
||||
|
||||
args.push(timeout.toString());
|
||||
// args.push(timeout.toString());
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export { transformReply } from './BZPOPMAX';
|
||||
// export { transformReply } from './BZPOPMAX';
|
||||
|
@@ -1,83 +1,83 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
interface CommonOptions {
|
||||
REDIRECT?: number;
|
||||
NOLOOP?: boolean;
|
||||
}
|
||||
// interface CommonOptions {
|
||||
// REDIRECT?: number;
|
||||
// NOLOOP?: boolean;
|
||||
// }
|
||||
|
||||
interface BroadcastOptions {
|
||||
BCAST?: boolean;
|
||||
PREFIX?: RedisCommandArgument | Array<RedisCommandArgument>;
|
||||
}
|
||||
// interface BroadcastOptions {
|
||||
// BCAST?: boolean;
|
||||
// PREFIX?: RedisCommandArgument | Array<RedisCommandArgument>;
|
||||
// }
|
||||
|
||||
interface OptInOptions {
|
||||
OPTIN?: boolean;
|
||||
}
|
||||
// interface OptInOptions {
|
||||
// OPTIN?: boolean;
|
||||
// }
|
||||
|
||||
interface OptOutOptions {
|
||||
OPTOUT?: boolean;
|
||||
}
|
||||
// interface OptOutOptions {
|
||||
// OPTOUT?: boolean;
|
||||
// }
|
||||
|
||||
type ClientTrackingOptions = CommonOptions & (
|
||||
BroadcastOptions |
|
||||
OptInOptions |
|
||||
OptOutOptions
|
||||
);
|
||||
// type ClientTrackingOptions = CommonOptions & (
|
||||
// BroadcastOptions |
|
||||
// OptInOptions |
|
||||
// OptOutOptions
|
||||
// );
|
||||
|
||||
export function transformArguments<M extends boolean>(
|
||||
mode: M,
|
||||
options?: M extends true ? ClientTrackingOptions : undefined
|
||||
): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = [
|
||||
'CLIENT',
|
||||
'TRACKING',
|
||||
mode ? 'ON' : 'OFF'
|
||||
];
|
||||
// export function transformArguments<M extends boolean>(
|
||||
// mode: M,
|
||||
// options?: M extends true ? ClientTrackingOptions : undefined
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = [
|
||||
// 'CLIENT',
|
||||
// 'TRACKING',
|
||||
// mode ? 'ON' : 'OFF'
|
||||
// ];
|
||||
|
||||
if (mode) {
|
||||
if (options?.REDIRECT) {
|
||||
args.push(
|
||||
'REDIRECT',
|
||||
options.REDIRECT.toString()
|
||||
);
|
||||
}
|
||||
// if (mode) {
|
||||
// if (options?.REDIRECT) {
|
||||
// args.push(
|
||||
// 'REDIRECT',
|
||||
// options.REDIRECT.toString()
|
||||
// );
|
||||
// }
|
||||
|
||||
if (isBroadcast(options)) {
|
||||
args.push('BCAST');
|
||||
// if (isBroadcast(options)) {
|
||||
// args.push('BCAST');
|
||||
|
||||
if (options?.PREFIX) {
|
||||
if (Array.isArray(options.PREFIX)) {
|
||||
for (const prefix of options.PREFIX) {
|
||||
args.push('PREFIX', prefix);
|
||||
}
|
||||
} else {
|
||||
args.push('PREFIX', options.PREFIX);
|
||||
}
|
||||
}
|
||||
} else if (isOptIn(options)) {
|
||||
args.push('OPTIN');
|
||||
} else if (isOptOut(options)) {
|
||||
args.push('OPTOUT');
|
||||
}
|
||||
// if (options?.PREFIX) {
|
||||
// if (Array.isArray(options.PREFIX)) {
|
||||
// for (const prefix of options.PREFIX) {
|
||||
// args.push('PREFIX', prefix);
|
||||
// }
|
||||
// } else {
|
||||
// args.push('PREFIX', options.PREFIX);
|
||||
// }
|
||||
// }
|
||||
// } else if (isOptIn(options)) {
|
||||
// args.push('OPTIN');
|
||||
// } else if (isOptOut(options)) {
|
||||
// args.push('OPTOUT');
|
||||
// }
|
||||
|
||||
if (options?.NOLOOP) {
|
||||
args.push('NOLOOP');
|
||||
}
|
||||
}
|
||||
// if (options?.NOLOOP) {
|
||||
// args.push('NOLOOP');
|
||||
// }
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
function isBroadcast(options?: ClientTrackingOptions): options is BroadcastOptions {
|
||||
return (options as BroadcastOptions)?.BCAST === true;
|
||||
}
|
||||
// function isBroadcast(options?: ClientTrackingOptions): options is BroadcastOptions {
|
||||
// return (options as BroadcastOptions)?.BCAST === true;
|
||||
// }
|
||||
|
||||
function isOptIn(options?: ClientTrackingOptions): options is OptInOptions {
|
||||
return (options as OptInOptions)?.OPTIN === true;
|
||||
}
|
||||
// function isOptIn(options?: ClientTrackingOptions): options is OptInOptions {
|
||||
// return (options as OptInOptions)?.OPTIN === true;
|
||||
// }
|
||||
|
||||
function isOptOut(options?: ClientTrackingOptions): options is OptOutOptions {
|
||||
return (options as OptOutOptions)?.OPTOUT === true;
|
||||
}
|
||||
// function isOptOut(options?: ClientTrackingOptions): options is OptOutOptions {
|
||||
// return (options as OptOutOptions)?.OPTOUT === true;
|
||||
// }
|
||||
|
||||
export declare function transformReply(): 'OK' | Buffer;
|
||||
// export declare function transformReply(): 'OK' | Buffer;
|
||||
|
@@ -1,28 +1,28 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
|
||||
export function transformArguments(): RedisCommandArguments {
|
||||
return ['CLIENT', 'TRACKINGINFO'];
|
||||
}
|
||||
// export function transformArguments(): RedisCommandArguments {
|
||||
// return ['CLIENT', 'TRACKINGINFO'];
|
||||
// }
|
||||
|
||||
type RawReply = [
|
||||
'flags',
|
||||
Array<string>,
|
||||
'redirect',
|
||||
number,
|
||||
'prefixes',
|
||||
Array<string>
|
||||
];
|
||||
// type RawReply = [
|
||||
// 'flags',
|
||||
// Array<string>,
|
||||
// 'redirect',
|
||||
// number,
|
||||
// 'prefixes',
|
||||
// Array<string>
|
||||
// ];
|
||||
|
||||
interface Reply {
|
||||
flags: Set<string>;
|
||||
redirect: number;
|
||||
prefixes: Array<string>;
|
||||
}
|
||||
// interface Reply {
|
||||
// flags: Set<string>;
|
||||
// redirect: number;
|
||||
// prefixes: Array<string>;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: RawReply): Reply {
|
||||
return {
|
||||
flags: new Set(reply[1]),
|
||||
redirect: reply[3],
|
||||
prefixes: reply[5]
|
||||
};
|
||||
}
|
||||
// export function transformReply(reply: RawReply): Reply {
|
||||
// return {
|
||||
// flags: new Set(reply[1]),
|
||||
// redirect: reply[3],
|
||||
// prefixes: reply[5]
|
||||
// };
|
||||
// }
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
// import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(): RedisCommandArguments {
|
||||
return ['COMMAND'];
|
||||
}
|
||||
// export function transformArguments(): RedisCommandArguments {
|
||||
// return ['COMMAND'];
|
||||
// }
|
||||
|
||||
export function transformReply(reply: Array<CommandRawReply>): Array<CommandReply> {
|
||||
return reply.map(transformCommandReply);
|
||||
}
|
||||
// export function transformReply(reply: Array<CommandRawReply>): Array<CommandReply> {
|
||||
// return reply.map(transformCommandReply);
|
||||
// }
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(): RedisCommandArguments {
|
||||
return ['COMMAND', 'COUNT'];
|
||||
}
|
||||
// export function transformArguments(): RedisCommandArguments {
|
||||
// return ['COMMAND', 'COUNT'];
|
||||
// }
|
||||
|
||||
export declare function transformReply(): number;
|
||||
// export declare function transformReply(): number;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(args: Array<RedisCommandArgument>): RedisCommandArguments {
|
||||
return ['COMMAND', 'GETKEYS', ...args];
|
||||
}
|
||||
// export function transformArguments(args: Array<RedisCommandArgument>): RedisCommandArguments {
|
||||
// return ['COMMAND', 'GETKEYS', ...args];
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,24 +1,24 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(args: Array<RedisCommandArgument>): RedisCommandArguments {
|
||||
return ['COMMAND', 'GETKEYSANDFLAGS', ...args];
|
||||
}
|
||||
// export function transformArguments(args: Array<RedisCommandArgument>): RedisCommandArguments {
|
||||
// return ['COMMAND', 'GETKEYSANDFLAGS', ...args];
|
||||
// }
|
||||
|
||||
type KeysAndFlagsRawReply = Array<[
|
||||
RedisCommandArgument,
|
||||
RedisCommandArguments
|
||||
]>;
|
||||
// type KeysAndFlagsRawReply = Array<[
|
||||
// RedisCommandArgument,
|
||||
// RedisCommandArguments
|
||||
// ]>;
|
||||
|
||||
type KeysAndFlagsReply = Array<{
|
||||
key: RedisCommandArgument;
|
||||
flags: RedisCommandArguments;
|
||||
}>;
|
||||
// type KeysAndFlagsReply = Array<{
|
||||
// key: RedisCommandArgument;
|
||||
// flags: RedisCommandArguments;
|
||||
// }>;
|
||||
|
||||
export function transformReply(reply: KeysAndFlagsRawReply): KeysAndFlagsReply {
|
||||
return reply.map(([key, flags]) => ({
|
||||
key,
|
||||
flags
|
||||
}));
|
||||
}
|
||||
// export function transformReply(reply: KeysAndFlagsRawReply): KeysAndFlagsReply {
|
||||
// return reply.map(([key, flags]) => ({
|
||||
// key,
|
||||
// flags
|
||||
// }));
|
||||
// }
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
// import { CommandRawReply, CommandReply, transformCommandReply } from './generic-transformers';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(commands: Array<string>): RedisCommandArguments {
|
||||
return ['COMMAND', 'INFO', ...commands];
|
||||
}
|
||||
// export function transformArguments(commands: Array<string>): RedisCommandArguments {
|
||||
// return ['COMMAND', 'INFO', ...commands];
|
||||
// }
|
||||
|
||||
export function transformReply(reply: Array<CommandRawReply | null>): Array<CommandReply | null> {
|
||||
return reply.map(command => command ? transformCommandReply(command) : null);
|
||||
}
|
||||
// export function transformReply(reply: Array<CommandRawReply | null>): Array<CommandReply | null> {
|
||||
// return reply.map(command => command ? transformCommandReply(command) : null);
|
||||
// }
|
||||
|
@@ -1,31 +1,31 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export enum FilterBy {
|
||||
MODULE = 'MODULE',
|
||||
ACLCAT = 'ACLCAT',
|
||||
PATTERN = 'PATTERN'
|
||||
}
|
||||
// export enum FilterBy {
|
||||
// MODULE = 'MODULE',
|
||||
// ACLCAT = 'ACLCAT',
|
||||
// PATTERN = 'PATTERN'
|
||||
// }
|
||||
|
||||
interface Filter {
|
||||
filterBy: FilterBy;
|
||||
value: string;
|
||||
}
|
||||
// interface Filter {
|
||||
// filterBy: FilterBy;
|
||||
// value: string;
|
||||
// }
|
||||
|
||||
|
||||
export function transformArguments(filter?: Filter): RedisCommandArguments {
|
||||
const args = ['COMMAND', 'LIST'];
|
||||
// export function transformArguments(filter?: Filter): RedisCommandArguments {
|
||||
// const args = ['COMMAND', 'LIST'];
|
||||
|
||||
if (filter) {
|
||||
args.push(
|
||||
'FILTERBY',
|
||||
filter.filterBy,
|
||||
filter.value
|
||||
);
|
||||
}
|
||||
// if (filter) {
|
||||
// args.push(
|
||||
// 'FILTERBY',
|
||||
// filter.filterBy,
|
||||
// filter.value
|
||||
// );
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<string>;
|
||||
// export declare function transformReply(): Array<string>;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
transformArguments(keys: RedisArgument | Array<RedisArgument>) {
|
||||
transformArguments(keys: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['DEL'], keys);
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(keys: RedisArgument | Array<RedisArgument>) {
|
||||
transformArguments(keys: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['EXISTS'], keys);
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(library: RedisArgument) {
|
||||
return ['FUNCTION', 'DELETE', library];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['FUNCTION', 'DUMP'];
|
||||
},
|
||||
|
@@ -2,8 +2,8 @@ import { SimpleStringReply, Command } from '../RESP/types';
|
||||
import { RedisFlushModes } from './FLUSHALL';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(mode?: RedisFlushModes) {
|
||||
const args = ['FUNCTION', 'FLUSH'];
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['FUNCTION', 'KILL'];
|
||||
},
|
||||
|
@@ -1,16 +1,16 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { FunctionListItemReply, FunctionListRawItemReply, transformFunctionListItemReply } from './generic-transformers';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
// import { FunctionListItemReply, FunctionListRawItemReply, transformFunctionListItemReply } from './generic-transformers';
|
||||
|
||||
export function transformArguments(pattern?: string): RedisCommandArguments {
|
||||
const args = ['FUNCTION', 'LIST'];
|
||||
// export function transformArguments(pattern?: string): RedisCommandArguments {
|
||||
// const args = ['FUNCTION', 'LIST'];
|
||||
|
||||
if (pattern) {
|
||||
args.push(pattern);
|
||||
}
|
||||
// if (pattern) {
|
||||
// args.push(pattern);
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: Array<FunctionListRawItemReply>): Array<FunctionListItemReply> {
|
||||
return reply.map(transformFunctionListItemReply);
|
||||
}
|
||||
// export function transformReply(reply: Array<FunctionListRawItemReply>): Array<FunctionListItemReply> {
|
||||
// return reply.map(transformFunctionListItemReply);
|
||||
// }
|
||||
|
@@ -1,26 +1,26 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { transformArguments as transformFunctionListArguments } from './FUNCTION_LIST';
|
||||
import { FunctionListItemReply, FunctionListRawItemReply, transformFunctionListItemReply } from './generic-transformers';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
// import { transformArguments as transformFunctionListArguments } from './FUNCTION_LIST';
|
||||
// import { FunctionListItemReply, FunctionListRawItemReply, transformFunctionListItemReply } from './generic-transformers';
|
||||
|
||||
export function transformArguments(pattern?: string): RedisCommandArguments {
|
||||
const args = transformFunctionListArguments(pattern);
|
||||
args.push('WITHCODE');
|
||||
return args;
|
||||
}
|
||||
// export function transformArguments(pattern?: string): RedisCommandArguments {
|
||||
// const args = transformFunctionListArguments(pattern);
|
||||
// args.push('WITHCODE');
|
||||
// return args;
|
||||
// }
|
||||
|
||||
type FunctionListWithCodeRawItemReply = [
|
||||
...FunctionListRawItemReply,
|
||||
'library_code',
|
||||
string
|
||||
];
|
||||
// type FunctionListWithCodeRawItemReply = [
|
||||
// ...FunctionListRawItemReply,
|
||||
// 'library_code',
|
||||
// string
|
||||
// ];
|
||||
|
||||
interface FunctionListWithCodeItemReply extends FunctionListItemReply {
|
||||
libraryCode: string;
|
||||
}
|
||||
// interface FunctionListWithCodeItemReply extends FunctionListItemReply {
|
||||
// libraryCode: string;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: Array<FunctionListWithCodeRawItemReply>): Array<FunctionListWithCodeItemReply> {
|
||||
return reply.map(library => ({
|
||||
...transformFunctionListItemReply(library as unknown as FunctionListRawItemReply),
|
||||
libraryCode: library[7]
|
||||
}));
|
||||
}
|
||||
// export function transformReply(reply: Array<FunctionListWithCodeRawItemReply>): Array<FunctionListWithCodeItemReply> {
|
||||
// return reply.map(library => ({
|
||||
// ...transformFunctionListItemReply(library as unknown as FunctionListRawItemReply),
|
||||
// libraryCode: library[7]
|
||||
// }));
|
||||
// }
|
||||
|
@@ -1,22 +1,22 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
|
||||
interface FunctionLoadOptions {
|
||||
REPLACE?: boolean;
|
||||
}
|
||||
// interface FunctionLoadOptions {
|
||||
// REPLACE?: boolean;
|
||||
// }
|
||||
|
||||
export function transformArguments(
|
||||
code: string,
|
||||
options?: FunctionLoadOptions
|
||||
): RedisCommandArguments {
|
||||
const args = ['FUNCTION', 'LOAD'];
|
||||
// export function transformArguments(
|
||||
// code: string,
|
||||
// options?: FunctionLoadOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['FUNCTION', 'LOAD'];
|
||||
|
||||
if (options?.REPLACE) {
|
||||
args.push('REPLACE');
|
||||
}
|
||||
// if (options?.REPLACE) {
|
||||
// args.push('REPLACE');
|
||||
// }
|
||||
|
||||
args.push(code);
|
||||
// args.push(code);
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export declare function transformReply(): string;
|
||||
// export declare function transformReply(): string;
|
||||
|
@@ -1,16 +1,16 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export function transformArguments(
|
||||
dump: RedisCommandArgument,
|
||||
mode?: 'FLUSH' | 'APPEND' | 'REPLACE'
|
||||
): RedisCommandArguments {
|
||||
const args = ['FUNCTION', 'RESTORE', dump];
|
||||
// export function transformArguments(
|
||||
// dump: RedisCommandArgument,
|
||||
// mode?: 'FLUSH' | 'APPEND' | 'REPLACE'
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['FUNCTION', 'RESTORE', dump];
|
||||
|
||||
if (mode) {
|
||||
args.push(mode);
|
||||
}
|
||||
// if (mode) {
|
||||
// args.push(mode);
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export declare function transformReply(): 'OK';
|
||||
// export declare function transformReply(): 'OK';
|
||||
|
@@ -1,53 +1,65 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { CommandArguments, RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { GeoCoordinates } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
interface GeoMember extends GeoCoordinates {
|
||||
member: RedisCommandArgument;
|
||||
member: RedisArgument;
|
||||
}
|
||||
|
||||
interface NX {
|
||||
NX?: true;
|
||||
interface GeoAddOptions {
|
||||
condition: 'NX' | 'XX';
|
||||
/**
|
||||
* @deprecated Use `{ condition: 'NX' }` instead.
|
||||
*/
|
||||
NX?: boolean;
|
||||
/**
|
||||
* @deprecated Use `{ condition: 'XX' }` instead.
|
||||
*/
|
||||
XX?: boolean;
|
||||
CH?: boolean;
|
||||
}
|
||||
|
||||
interface XX {
|
||||
XX?: true;
|
||||
}
|
||||
|
||||
type SetGuards = NX | XX;
|
||||
|
||||
interface GeoAddCommonOptions {
|
||||
CH?: true;
|
||||
}
|
||||
|
||||
type GeoAddOptions = SetGuards & GeoAddCommonOptions;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument, toAdd: GeoMember | Array<GeoMember>,
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
toAdd: GeoMember | Array<GeoMember>,
|
||||
options?: GeoAddOptions
|
||||
): RedisCommandArguments {
|
||||
) {
|
||||
const args = ['GEOADD', key];
|
||||
|
||||
if ((options as NX)?.NX) {
|
||||
args.push('NX');
|
||||
} else if ((options as XX)?.XX) {
|
||||
args.push('XX');
|
||||
if (options?.condition) {
|
||||
args.push(options.condition);
|
||||
} else if (options?.NX) {
|
||||
args.push('NX');
|
||||
} else if (options?.XX) {
|
||||
args.push('XX');
|
||||
}
|
||||
|
||||
if (options?.CH) {
|
||||
args.push('CH');
|
||||
args.push('CH');
|
||||
}
|
||||
|
||||
for (const { longitude, latitude, member } of (Array.isArray(toAdd) ? toAdd : [toAdd])) {
|
||||
args.push(
|
||||
longitude.toString(),
|
||||
latitude.toString(),
|
||||
member
|
||||
);
|
||||
if (Array.isArray(toAdd)) {
|
||||
for (const member of toAdd) {
|
||||
pushMember(args, member);
|
||||
}
|
||||
} else {
|
||||
pushMember(args, toAdd);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
||||
export declare function transformReply(): number;
|
||||
function pushMember(
|
||||
args: CommandArguments,
|
||||
{ longitude, latitude, member }: GeoMember
|
||||
) {
|
||||
args.push(
|
||||
longitude.toString(),
|
||||
latitude.toString(),
|
||||
member
|
||||
);
|
||||
}
|
||||
|
@@ -1,16 +1,15 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types';
|
||||
import { GeoUnits } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member1: RedisCommandArgument,
|
||||
member2: RedisCommandArgument,
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
member1: RedisArgument,
|
||||
member2: RedisArgument,
|
||||
unit?: GeoUnits
|
||||
): RedisCommandArguments {
|
||||
) {
|
||||
const args = ['GEODIST', key, member1, member2];
|
||||
|
||||
if (unit) {
|
||||
@@ -18,8 +17,8 @@ export function transformArguments(
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export function transformReply(reply: RedisCommandArgument | null): number | null {
|
||||
},
|
||||
transformReply(reply: BlobStringReply | NullReply) {
|
||||
return reply === null ? null : Number(reply);
|
||||
}
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,15 +1,14 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
member: RedisVariadicArgument
|
||||
) {
|
||||
return pushVariadicArguments(['GEOHASH', key], member);
|
||||
}
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
},
|
||||
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,27 +1,19 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { ArrayReply, BlobStringReply, NullReply, Command, RedisArgument } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
member: RedisVariadicArgument
|
||||
) {
|
||||
return pushVariadicArguments(['GEOPOS', key], member);
|
||||
}
|
||||
|
||||
type GeoCoordinatesRawReply = Array<[RedisCommandArgument, RedisCommandArgument] | null>;
|
||||
|
||||
interface GeoCoordinates {
|
||||
longitude: RedisCommandArgument;
|
||||
latitude: RedisCommandArgument;
|
||||
}
|
||||
|
||||
export function transformReply(reply: GeoCoordinatesRawReply): Array<GeoCoordinates | null> {
|
||||
return reply.map(coordinates => coordinates === null ? null : {
|
||||
longitude: coordinates[0],
|
||||
latitude: coordinates[1]
|
||||
},
|
||||
transformReply(reply: ArrayReply<[BlobStringReply, BlobStringReply] | NullReply>) {
|
||||
return reply.map(item => item === null ? null : {
|
||||
longitude: item[0],
|
||||
latitude: item[1]
|
||||
});
|
||||
}
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchOptions, GeoCoordinates, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchOptions, GeoCoordinates, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
coordinates: GeoCoordinates,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
return pushGeoRadiusArguments(
|
||||
['GEORADIUS'],
|
||||
key,
|
||||
coordinates,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// coordinates: GeoCoordinates,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoRadiusArguments(
|
||||
// ['GEORADIUS'],
|
||||
// key,
|
||||
// coordinates,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchOptions, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchOptions, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: string,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
return pushGeoRadiusArguments(
|
||||
['GEORADIUSBYMEMBER'],
|
||||
key,
|
||||
member,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// member: string,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoRadiusArguments(
|
||||
// ['GEORADIUSBYMEMBER'],
|
||||
// key,
|
||||
// member,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoUnits, GeoRadiusStoreOptions, pushGeoRadiusStoreArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoUnits, GeoRadiusStoreOptions, pushGeoRadiusStoreArguments } from './generic-transformers';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUSBYMEMBER';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUSBYMEMBER';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: string,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
destination: RedisCommandArgument,
|
||||
options?: GeoRadiusStoreOptions,
|
||||
): RedisCommandArguments {
|
||||
return pushGeoRadiusStoreArguments(
|
||||
['GEORADIUSBYMEMBER'],
|
||||
key,
|
||||
member,
|
||||
radius,
|
||||
unit,
|
||||
destination,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// member: string,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// destination: RedisCommandArgument,
|
||||
// options?: GeoRadiusStoreOptions,
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoRadiusStoreArguments(
|
||||
// ['GEORADIUSBYMEMBER'],
|
||||
// key,
|
||||
// member,
|
||||
// radius,
|
||||
// unit,
|
||||
// destination,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export declare function transformReply(): number
|
||||
// export declare function transformReply(): number
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchOptions, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchOptions, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: string,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
return pushGeoRadiusArguments(
|
||||
['GEORADIUSBYMEMBER_RO'],
|
||||
key,
|
||||
member,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// member: string,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoRadiusArguments(
|
||||
// ['GEORADIUSBYMEMBER_RO'],
|
||||
// key,
|
||||
// member,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,30 +1,30 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoReplyWith, GeoSearchOptions, GeoUnits } from './generic-transformers';
|
||||
import { transformArguments as geoRadiusTransformArguments } from './GEORADIUSBYMEMBER_RO';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoReplyWith, GeoSearchOptions, GeoUnits } from './generic-transformers';
|
||||
// import { transformArguments as geoRadiusTransformArguments } from './GEORADIUSBYMEMBER_RO';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUSBYMEMBER_RO';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUSBYMEMBER_RO';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: string,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
replyWith: Array<GeoReplyWith>,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = geoRadiusTransformArguments(
|
||||
key,
|
||||
member,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// member: string,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// replyWith: Array<GeoReplyWith>,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = geoRadiusTransformArguments(
|
||||
// key,
|
||||
// member,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
|
||||
args.push(...replyWith);
|
||||
// args.push(...replyWith);
|
||||
|
||||
args.preserve = replyWith;
|
||||
// args.preserve = replyWith;
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
// export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
|
@@ -1,30 +1,30 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoReplyWith, GeoSearchOptions, GeoUnits } from './generic-transformers';
|
||||
import { transformArguments as transformGeoRadiusArguments } from './GEORADIUSBYMEMBER';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoReplyWith, GeoSearchOptions, GeoUnits } from './generic-transformers';
|
||||
// import { transformArguments as transformGeoRadiusArguments } from './GEORADIUSBYMEMBER';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUSBYMEMBER';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUSBYMEMBER';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: string,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
replyWith: Array<GeoReplyWith>,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = transformGeoRadiusArguments(
|
||||
key,
|
||||
member,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// member: string,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// replyWith: Array<GeoReplyWith>,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = transformGeoRadiusArguments(
|
||||
// key,
|
||||
// member,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
|
||||
args.push(...replyWith);
|
||||
// args.push(...replyWith);
|
||||
|
||||
args.preserve = replyWith;
|
||||
// args.preserve = replyWith;
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
// export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoCoordinates, GeoUnits, GeoRadiusStoreOptions, pushGeoRadiusStoreArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoCoordinates, GeoUnits, GeoRadiusStoreOptions, pushGeoRadiusStoreArguments } from './generic-transformers';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUS';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUS';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
coordinates: GeoCoordinates,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
destination: RedisCommandArgument,
|
||||
options?: GeoRadiusStoreOptions,
|
||||
): RedisCommandArguments {
|
||||
return pushGeoRadiusStoreArguments(
|
||||
['GEORADIUS'],
|
||||
key,
|
||||
coordinates,
|
||||
radius,
|
||||
unit,
|
||||
destination,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// coordinates: GeoCoordinates,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// destination: RedisCommandArgument,
|
||||
// options?: GeoRadiusStoreOptions,
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoRadiusStoreArguments(
|
||||
// ['GEORADIUS'],
|
||||
// key,
|
||||
// coordinates,
|
||||
// radius,
|
||||
// unit,
|
||||
// destination,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export declare function transformReply(): number;
|
||||
// export declare function transformReply(): number;
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchOptions, GeoCoordinates, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchOptions, GeoCoordinates, pushGeoRadiusArguments, GeoUnits } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
coordinates: GeoCoordinates,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
return pushGeoRadiusArguments(
|
||||
['GEORADIUS_RO'],
|
||||
key,
|
||||
coordinates,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// coordinates: GeoCoordinates,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoRadiusArguments(
|
||||
// ['GEORADIUS_RO'],
|
||||
// key,
|
||||
// coordinates,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,30 +1,30 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoReplyWith, GeoSearchOptions, GeoCoordinates, GeoUnits } from './generic-transformers';
|
||||
import { transformArguments as transformGeoRadiusRoArguments } from './GEORADIUS_RO';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoReplyWith, GeoSearchOptions, GeoCoordinates, GeoUnits } from './generic-transformers';
|
||||
// import { transformArguments as transformGeoRadiusRoArguments } from './GEORADIUS_RO';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUS_RO';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUS_RO';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
coordinates: GeoCoordinates,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
replyWith: Array<GeoReplyWith>,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = transformGeoRadiusRoArguments(
|
||||
key,
|
||||
coordinates,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// coordinates: GeoCoordinates,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// replyWith: Array<GeoReplyWith>,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = transformGeoRadiusRoArguments(
|
||||
// key,
|
||||
// coordinates,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
|
||||
args.push(...replyWith);
|
||||
// args.push(...replyWith);
|
||||
|
||||
args.preserve = replyWith;
|
||||
// args.preserve = replyWith;
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
// export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
|
@@ -1,30 +1,30 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoReplyWith, GeoSearchOptions, GeoCoordinates, GeoUnits } from './generic-transformers';
|
||||
import { transformArguments as transformGeoRadiusArguments } from './GEORADIUS';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoReplyWith, GeoSearchOptions, GeoCoordinates, GeoUnits } from './generic-transformers';
|
||||
// import { transformArguments as transformGeoRadiusArguments } from './GEORADIUS';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUS';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEORADIUS';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
coordinates: GeoCoordinates,
|
||||
radius: number,
|
||||
unit: GeoUnits,
|
||||
replyWith: Array<GeoReplyWith>,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = transformGeoRadiusArguments(
|
||||
key,
|
||||
coordinates,
|
||||
radius,
|
||||
unit,
|
||||
options
|
||||
);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// coordinates: GeoCoordinates,
|
||||
// radius: number,
|
||||
// unit: GeoUnits,
|
||||
// replyWith: Array<GeoReplyWith>,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = transformGeoRadiusArguments(
|
||||
// key,
|
||||
// coordinates,
|
||||
// radius,
|
||||
// unit,
|
||||
// options
|
||||
// );
|
||||
|
||||
args.push(...replyWith);
|
||||
// args.push(...replyWith);
|
||||
|
||||
args.preserve = replyWith;
|
||||
// args.preserve = replyWith;
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
// export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
|
@@ -1,17 +1,17 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
from: GeoSearchFrom,
|
||||
by: GeoSearchBy,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
return pushGeoSearchArguments(['GEOSEARCH'], key, from, by, options);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// from: GeoSearchFrom,
|
||||
// by: GeoSearchBy,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// return pushGeoSearchArguments(['GEOSEARCH'], key, from, by, options);
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,38 +1,38 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEOSEARCH';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEOSEARCH';
|
||||
|
||||
interface GeoSearchStoreOptions extends GeoSearchOptions {
|
||||
STOREDIST?: true;
|
||||
}
|
||||
// interface GeoSearchStoreOptions extends GeoSearchOptions {
|
||||
// STOREDIST?: true;
|
||||
// }
|
||||
|
||||
export function transformArguments(
|
||||
destination: RedisCommandArgument,
|
||||
source: RedisCommandArgument,
|
||||
from: GeoSearchFrom,
|
||||
by: GeoSearchBy,
|
||||
options?: GeoSearchStoreOptions
|
||||
): RedisCommandArguments {
|
||||
const args = pushGeoSearchArguments(
|
||||
['GEOSEARCHSTORE', destination],
|
||||
source,
|
||||
from,
|
||||
by,
|
||||
options
|
||||
);
|
||||
// export function transformArguments(
|
||||
// destination: RedisCommandArgument,
|
||||
// source: RedisCommandArgument,
|
||||
// from: GeoSearchFrom,
|
||||
// by: GeoSearchBy,
|
||||
// options?: GeoSearchStoreOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args = pushGeoSearchArguments(
|
||||
// ['GEOSEARCHSTORE', destination],
|
||||
// source,
|
||||
// from,
|
||||
// by,
|
||||
// options
|
||||
// );
|
||||
|
||||
if (options?.STOREDIST) {
|
||||
args.push('STOREDIST');
|
||||
}
|
||||
// if (options?.STOREDIST) {
|
||||
// args.push('STOREDIST');
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: number): number {
|
||||
if (typeof reply !== 'number') {
|
||||
throw new TypeError(`https://github.com/redis/redis/issues/9261`);
|
||||
}
|
||||
// export function transformReply(reply: number): number {
|
||||
// if (typeof reply !== 'number') {
|
||||
// throw new TypeError(`https://github.com/redis/redis/issues/9261`);
|
||||
// }
|
||||
|
||||
return reply;
|
||||
}
|
||||
// return reply;
|
||||
// }
|
||||
|
@@ -1,23 +1,23 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { GeoSearchFrom, GeoSearchBy, GeoReplyWith, GeoSearchOptions } from './generic-transformers';
|
||||
import { transformArguments as geoSearchTransformArguments } from './GEOSEARCH';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { GeoSearchFrom, GeoSearchBy, GeoReplyWith, GeoSearchOptions } from './generic-transformers';
|
||||
// import { transformArguments as geoSearchTransformArguments } from './GEOSEARCH';
|
||||
|
||||
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEOSEARCH';
|
||||
// export { FIRST_KEY_INDEX, IS_READ_ONLY } from './GEOSEARCH';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
from: GeoSearchFrom,
|
||||
by: GeoSearchBy,
|
||||
replyWith: Array<GeoReplyWith>,
|
||||
options?: GeoSearchOptions
|
||||
): RedisCommandArguments {
|
||||
const args: RedisCommandArguments = geoSearchTransformArguments(key, from, by, options);
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// from: GeoSearchFrom,
|
||||
// by: GeoSearchBy,
|
||||
// replyWith: Array<GeoReplyWith>,
|
||||
// options?: GeoSearchOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args: RedisCommandArguments = geoSearchTransformArguments(key, from, by, options);
|
||||
|
||||
args.push(...replyWith);
|
||||
// args.push(...replyWith);
|
||||
|
||||
args.preserve = replyWith;
|
||||
// args.preserve = replyWith;
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
// export { transformGeoMembersWithReply as transformReply } from './generic-transformers';
|
||||
|
@@ -1,15 +1,11 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { NumberReply, Command, RedisArgument } from '../RESP/types';
|
||||
import { BitValue } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
offset: number
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument, offset: number) {
|
||||
return ['GETBIT', key, offset.toString()];
|
||||
}
|
||||
|
||||
export declare function transformReply(): BitValue;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply<BitValue>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { RedisArgument, BlobStringReply, Command } from '../RESP/types';
|
||||
import { ScanOptions, pushScanArguments } from './generic-transformers';
|
||||
import { ScanCommonOptions, pushScanArguments } from './SCAN';
|
||||
|
||||
export interface HScanEntry {
|
||||
field: BlobStringReply;
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
cursor: number,
|
||||
options?: ScanOptions
|
||||
options?: ScanCommonOptions
|
||||
) {
|
||||
return pushScanArguments(['HSCAN', key], cursor, options);
|
||||
},
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArguments } from '.';
|
||||
|
||||
export type EventType =
|
||||
'active-defrag-cycle'
|
||||
| 'aof-fsync-always'
|
||||
| 'aof-stat'
|
||||
| 'aof-rewrite-diff-write'
|
||||
| 'aof-rename'
|
||||
| 'aof-write'
|
||||
| 'aof-write-active-child'
|
||||
| 'aof-write-alone'
|
||||
| 'aof-write-pending-fsync'
|
||||
| 'command'
|
||||
| 'expire-cycle'
|
||||
| 'eviction-cycle'
|
||||
| 'eviction-del'
|
||||
| 'fast-command'
|
||||
| 'fork'
|
||||
| 'rdb-unlink-temp-file';
|
||||
// export type EventType =
|
||||
// 'active-defrag-cycle'
|
||||
// | 'aof-fsync-always'
|
||||
// | 'aof-stat'
|
||||
// | 'aof-rewrite-diff-write'
|
||||
// | 'aof-rename'
|
||||
// | 'aof-write'
|
||||
// | 'aof-write-active-child'
|
||||
// | 'aof-write-alone'
|
||||
// | 'aof-write-pending-fsync'
|
||||
// | 'command'
|
||||
// | 'expire-cycle'
|
||||
// | 'eviction-cycle'
|
||||
// | 'eviction-del'
|
||||
// | 'fast-command'
|
||||
// | 'fork'
|
||||
// | 'rdb-unlink-temp-file';
|
||||
|
||||
export function transformArguments(event: EventType): RedisCommandArguments {
|
||||
return ['LATENCY', 'GRAPH', event];
|
||||
}
|
||||
// export function transformArguments(event: EventType): RedisCommandArguments {
|
||||
// return ['LATENCY', 'GRAPH', event];
|
||||
// }
|
||||
|
||||
export declare function transformReply(): string;
|
||||
// export declare function transformReply(): string;
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { RedisArgument, NullReply, TuplesReply, BlobStringReply, Command } from '../RESP/types';
|
||||
import { transformLMPopArguments, LMPopOptions, ListSide } from './generic-transformers';
|
||||
import { NullReply, TuplesReply, BlobStringReply, Command } from '../RESP/types';
|
||||
import { transformLMPopArguments, LMPopOptions, ListSide, RedisVariadicArgument } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 2,
|
||||
transformArguments(
|
||||
keys: RedisArgument | Array<RedisArgument>,
|
||||
keys: RedisVariadicArgument,
|
||||
side: ListSide,
|
||||
options?: LMPopOptions
|
||||
) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(version?: number, ...optionalArguments: Array<number>) {
|
||||
const args = ['LOLWUT'];
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { RedisArgument, NullReply, ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
FIRST_KEY_INDEX: 2,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(key: RedisArgument, count: number) {
|
||||
return ['LPOP', key, count.toString()];
|
||||
},
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
transformArguments(key: RedisArgument, elements: RedisArgument | Array<RedisArgument>) {
|
||||
transformArguments(key: RedisArgument, elements: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['LPUSH', key], elements);
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
transformArguments(key: RedisArgument, elements: RedisArgument | Array<RedisArgument>) {
|
||||
transformArguments(key: RedisArgument, elements: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['LPUSHX', key], elements);
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
|
@@ -6,8 +6,8 @@ export type ModuleListReply = ArrayReply<TuplesToMapReply<[
|
||||
]>>;
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['MODULE', 'LIST'];
|
||||
},
|
||||
|
@@ -2,10 +2,16 @@ import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(path: RedisArgument, moduleArguments?: Array<RedisArgument>) {
|
||||
return pushVariadicArguments(['MODULE', 'LOAD', path], moduleArguments);
|
||||
const args = ['MODULE', 'LOAD', path];
|
||||
|
||||
if (moduleArguments) {
|
||||
return args.concat(moduleArguments);
|
||||
}
|
||||
|
||||
return args;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(name: RedisArgument) {
|
||||
return ['MODULE', 'UNLOAD', name];
|
||||
},
|
||||
|
@@ -1,11 +1,14 @@
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument, element?: RedisArgument | Array<RedisArgument>) {
|
||||
return pushVariadicArguments(['PFADD', key], element);
|
||||
transformArguments(key: RedisArgument, element?: RedisVariadicArgument) {
|
||||
const args = ['PFADD', key];
|
||||
if (!element) return args;
|
||||
|
||||
return pushVariadicArguments(args, element);
|
||||
},
|
||||
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key?: RedisArgument | Array<RedisArgument>) {
|
||||
transformArguments(key: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['PFCOUNT'], key);
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
|
@@ -1,13 +1,16 @@
|
||||
import { RedisArgument, SimpleStringReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
transformArguments(
|
||||
destination: RedisArgument,
|
||||
source?: RedisArgument | Array<RedisArgument>
|
||||
source?: RedisVariadicArgument
|
||||
) {
|
||||
return pushVariadicArguments(['PFMERGE', destination], source);
|
||||
const args = ['PFMERGE', destination];
|
||||
if (!source) return args;
|
||||
|
||||
return pushVariadicArguments(args, source);
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(channel: RedisArgument, message: RedisArgument) {
|
||||
return ['PUBLISH', channel, message];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(pattern?: RedisArgument) {
|
||||
const args: Array<RedisArgument> = ['PUBSUB', 'CHANNELS'];
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['PUBSUB', 'NUMPAT'];
|
||||
},
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { ArrayReply, BlobStringReply, NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
transformArguments(channels?: RedisArgument | Array<RedisArgument>) {
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(channels?: RedisVariadicArgument) {
|
||||
const args = ['PUBSUB', 'NUMSUB'];
|
||||
|
||||
if (channels) return pushVariadicArguments(args, channels);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(pattern?: RedisArgument) {
|
||||
const args: Array<RedisArgument> = ['PUBSUB', 'bb'];
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['READONLY'];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['READWRITE'];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(host: string, port: number) {
|
||||
return ['REPLICAOF', host, port.toString()];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['RESTORE-ASKING'];
|
||||
},
|
||||
|
@@ -22,8 +22,8 @@ type SentinelRole = [
|
||||
type Role = MasterRole | SlaveRole | SentinelRole;
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['ROLE'];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['SAVE'];
|
||||
},
|
||||
|
@@ -1,84 +1,62 @@
|
||||
import { strict as assert } from 'assert';
|
||||
import testUtils, { GLOBAL } from '../test-utils';
|
||||
import { transformArguments, transformReply } from './SCAN';
|
||||
import SCAN from './SCAN';
|
||||
|
||||
describe('SCAN', () => {
|
||||
describe('transformArguments', () => {
|
||||
it('cusror only', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0),
|
||||
['SCAN', '0']
|
||||
);
|
||||
});
|
||||
|
||||
it('with MATCH', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, {
|
||||
MATCH: 'pattern'
|
||||
}),
|
||||
['SCAN', '0', 'MATCH', 'pattern']
|
||||
);
|
||||
});
|
||||
|
||||
it('with COUNT', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, {
|
||||
COUNT: 1
|
||||
}),
|
||||
['SCAN', '0', 'COUNT', '1']
|
||||
);
|
||||
});
|
||||
|
||||
it('with TYPE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, {
|
||||
TYPE: 'stream'
|
||||
}),
|
||||
['SCAN', '0', 'TYPE', 'stream']
|
||||
);
|
||||
});
|
||||
|
||||
it('with MATCH & COUNT & TYPE', () => {
|
||||
assert.deepEqual(
|
||||
transformArguments(0, {
|
||||
MATCH: 'pattern',
|
||||
COUNT: 1,
|
||||
TYPE: 'stream'
|
||||
}),
|
||||
['SCAN', '0', 'MATCH', 'pattern', 'COUNT', '1', 'TYPE', 'stream']
|
||||
);
|
||||
});
|
||||
describe('transformArguments', () => {
|
||||
it('cusror only', () => {
|
||||
assert.deepEqual(
|
||||
SCAN.transformArguments(0),
|
||||
['SCAN', '0']
|
||||
);
|
||||
});
|
||||
|
||||
describe('transformReply', () => {
|
||||
it('without keys', () => {
|
||||
assert.deepEqual(
|
||||
transformReply(['0', []]),
|
||||
{
|
||||
cursor: 0,
|
||||
keys: []
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('with keys', () => {
|
||||
assert.deepEqual(
|
||||
transformReply(['0', ['key']]),
|
||||
{
|
||||
cursor: 0,
|
||||
keys: ['key']
|
||||
}
|
||||
);
|
||||
});
|
||||
it('with MATCH', () => {
|
||||
assert.deepEqual(
|
||||
SCAN.transformArguments(0, {
|
||||
MATCH: 'pattern'
|
||||
}),
|
||||
['SCAN', '0', 'MATCH', 'pattern']
|
||||
);
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.scan', async client => {
|
||||
assert.deepEqual(
|
||||
await client.scan(0),
|
||||
{
|
||||
cursor: 0,
|
||||
keys: []
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
it('with COUNT', () => {
|
||||
assert.deepEqual(
|
||||
SCAN.transformArguments(0, {
|
||||
COUNT: 1
|
||||
}),
|
||||
['SCAN', '0', 'COUNT', '1']
|
||||
);
|
||||
});
|
||||
|
||||
it('with TYPE', () => {
|
||||
assert.deepEqual(
|
||||
SCAN.transformArguments(0, {
|
||||
TYPE: 'stream'
|
||||
}),
|
||||
['SCAN', '0', 'TYPE', 'stream']
|
||||
);
|
||||
});
|
||||
|
||||
it('with MATCH & COUNT & TYPE', () => {
|
||||
assert.deepEqual(
|
||||
SCAN.transformArguments(0, {
|
||||
MATCH: 'pattern',
|
||||
COUNT: 1,
|
||||
TYPE: 'stream'
|
||||
}),
|
||||
['SCAN', '0', 'MATCH', 'pattern', 'COUNT', '1', 'TYPE', 'stream']
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
testUtils.testWithClient('client.scan', async client => {
|
||||
assert.deepEqual(
|
||||
await client.scan(0),
|
||||
{
|
||||
cursor: 0,
|
||||
keys: []
|
||||
}
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
@@ -1,13 +1,35 @@
|
||||
import { RedisArgument, BlobStringReply, ArrayReply, Command } from '../RESP/types';
|
||||
import { ScanOptions, pushScanArguments } from './generic-transformers';
|
||||
import { CommandArguments, RedisArgument, BlobStringReply, ArrayReply, Command } from '../RESP/types';
|
||||
|
||||
export interface ScanCommandOptions extends ScanOptions {
|
||||
export interface ScanCommonOptions {
|
||||
MATCH?: string;
|
||||
COUNT?: number;
|
||||
}
|
||||
|
||||
export function pushScanArguments(
|
||||
args: CommandArguments,
|
||||
cursor: number,
|
||||
options?: ScanOptions
|
||||
): CommandArguments {
|
||||
args.push(cursor.toString());
|
||||
|
||||
if (options?.MATCH) {
|
||||
args.push('MATCH', options.MATCH);
|
||||
}
|
||||
|
||||
if (options?.COUNT) {
|
||||
args.push('COUNT', options.COUNT.toString());
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export interface ScanOptions extends ScanCommonOptions {
|
||||
TYPE?: RedisArgument;
|
||||
}
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(cursor: number, options?: ScanCommandOptions) {
|
||||
transformArguments(cursor: number, options?: ScanOptions) {
|
||||
const args = pushScanArguments(['SCAN'], cursor, options);
|
||||
|
||||
if (options?.TYPE) {
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(mode: 'YES' | 'SYNC' | 'NO') {
|
||||
return ['SCRIPT', 'DEBUG', mode];
|
||||
},
|
||||
|
@@ -1,10 +1,10 @@
|
||||
import { RedisArgument, ArrayReply, NumberReply, Command } from '../RESP/types';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { ArrayReply, NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
transformArguments(sha1: RedisArgument | Array<RedisArgument>) {
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(sha1: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['SCRIPT', 'EXISTS'], sha1);
|
||||
},
|
||||
transformReply: undefined as unknown as () => ArrayReply<NumberReply>
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(mode?: 'ASYNC' | 'SYNC') {
|
||||
const args = ['SCRIPT', 'FLUSH'];
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments() {
|
||||
return ['SCRIPT', 'KILL'];
|
||||
},
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { BlobStringReply, Command, RedisArgument } from '../RESP/types';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: true,
|
||||
FIRST_KEY_INDEX: undefined,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(script: RedisArgument) {
|
||||
return ['SCRIPT', 'LOAD', script];
|
||||
},
|
||||
|
@@ -2,8 +2,8 @@ import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { BitValue } from './generic-transformers';
|
||||
|
||||
export default {
|
||||
IS_READ_ONLY: false,
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
offset: number,
|
||||
|
@@ -1,13 +1,14 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
destination: RedisCommandArgument,
|
||||
keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
destination: RedisArgument,
|
||||
keys: RedisVariadicArgument
|
||||
) {
|
||||
return pushVariadicArguments(['SINTERSTORE', destination], keys);
|
||||
}
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,12 +1,10 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { NumberReply, Command, RedisArgument } from '../RESP/types';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
member: RedisCommandArgument
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument, member: RedisArgument) {
|
||||
return ['SISMEMBER', key, member];
|
||||
}
|
||||
|
||||
export { transformBooleanReply as transformReply } from './generic-transformers';
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,12 +1,10 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { RedisArgument, ArrayReply, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
members: Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument, members: Array<RedisArgument>) {
|
||||
return ['SMISMEMBER', key, ...members];
|
||||
}
|
||||
|
||||
export { transformBooleanArrayReply as transformReply } from './generic-transformers';
|
||||
},
|
||||
transformReply: undefined as unknown as () => ArrayReply<NumberReply>
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
source: RedisCommandArgument,
|
||||
destination: RedisCommandArgument,
|
||||
member: RedisCommandArgument
|
||||
): RedisCommandArguments {
|
||||
return ['SMOVE', source, destination, member];
|
||||
}
|
||||
// export function transformArguments(
|
||||
// source: RedisCommandArgument,
|
||||
// destination: RedisCommandArgument,
|
||||
// member: RedisCommandArgument
|
||||
// ): RedisCommandArguments {
|
||||
// return ['SMOVE', source, destination, member];
|
||||
// }
|
||||
|
||||
export { transformBooleanReply as transformReply } from './generic-transformers';
|
||||
// export { transformBooleanReply as transformReply } from './generic-transformers';
|
||||
|
@@ -1,13 +1,59 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { pushSortArguments, SortOptions } from './generic-transformers';
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, Command } from '../RESP/types';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: string,
|
||||
options?: SortOptions
|
||||
): RedisCommandArguments {
|
||||
return pushSortArguments(['SORT', key], options);
|
||||
export interface SortOptions {
|
||||
BY?: string;
|
||||
LIMIT?: {
|
||||
offset: number;
|
||||
count: number;
|
||||
},
|
||||
GET?: string | Array<string>;
|
||||
DIRECTION?: 'ASC' | 'DESC';
|
||||
ALPHA?: true;
|
||||
}
|
||||
|
||||
export declare function transformReply(): Array<string>;
|
||||
export function transformSortArguments(
|
||||
command: RedisArgument,
|
||||
options?: SortOptions
|
||||
) {
|
||||
const args = [command];
|
||||
|
||||
if (options?.BY) {
|
||||
args.push('BY', options.BY);
|
||||
}
|
||||
|
||||
if (options?.LIMIT) {
|
||||
args.push(
|
||||
'LIMIT',
|
||||
options.LIMIT.offset.toString(),
|
||||
options.LIMIT.count.toString()
|
||||
);
|
||||
}
|
||||
|
||||
if (options?.GET) {
|
||||
if (typeof options.GET === 'string') {
|
||||
args.push('GET', options.GET);
|
||||
} else {
|
||||
for (const pattern of options.GET) {
|
||||
args.push('GET', pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (options?.DIRECTION) {
|
||||
args.push(options.DIRECTION);
|
||||
}
|
||||
|
||||
if (options?.ALPHA) {
|
||||
args.push('ALPHA');
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments: transformSortArguments.bind(undefined, 'SORT'),
|
||||
transformReply: undefined as unknown as () => ArrayReply<BlobStringReply>
|
||||
} as const satisfies Command;
|
||||
|
||||
|
@@ -1,15 +1,9 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { pushSortArguments, SortOptions } from "./generic-transformers";
|
||||
import { Command } from '../RESP/types';
|
||||
import SORT, { transformSortArguments } from './SORT';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
key: string,
|
||||
options?: SortOptions
|
||||
): RedisCommandArguments {
|
||||
return pushSortArguments(['SORT_RO', key], options);
|
||||
}
|
||||
|
||||
export declare function transformReply(): Array<string>;
|
||||
export default {
|
||||
FIRST_KEY_INDEX: SORT.FIRST_KEY_INDEX,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments: transformSortArguments.bind(undefined, 'SORT_RO'),
|
||||
transformReply: SORT.transformReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,17 +1,17 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { SortOptions } from './generic-transformers';
|
||||
import { transformArguments as transformSortArguments } from './SORT';
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
import { SortOptions, transformSortArguments } from './SORT';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
source: string,
|
||||
destination: string,
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(
|
||||
source: RedisArgument,
|
||||
destination: RedisArgument,
|
||||
options?: SortOptions
|
||||
): RedisCommandArguments {
|
||||
) {
|
||||
const args = transformSortArguments(source, options);
|
||||
args.push('STORE', destination);
|
||||
return args;
|
||||
}
|
||||
|
||||
export declare function transformReply(): number;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,18 +1,18 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
count?: number
|
||||
): RedisCommandArguments {
|
||||
const args = ['SPOP', key];
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// count?: number
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['SPOP', key];
|
||||
|
||||
if (typeof count === 'number') {
|
||||
args.push(count.toString());
|
||||
}
|
||||
// if (typeof count === 'number') {
|
||||
// args.push(count.toString());
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,14 +1,10 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { RedisArgument, NumberReply, Command } from '../RESP/types';
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
channel: RedisCommandArgument,
|
||||
message: RedisCommandArgument
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(channel: RedisArgument, message: RedisArgument) {
|
||||
return ['SPUBLISH', channel, message];
|
||||
}
|
||||
|
||||
export declare function transformReply(): number;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { RedisArgument, BlobStringReply, NullReply, Command } from '../RESP/types';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisArgument) {
|
||||
return ['SRANDMEMBER', key];
|
||||
}
|
||||
|
||||
export declare function transformReply(): RedisCommandArgument | null;
|
||||
},
|
||||
transformReply: undefined as unknown as () => BlobStringReply | NullReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,16 +1,16 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { transformArguments as transformSRandMemberArguments } from './SRANDMEMBER';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { transformArguments as transformSRandMemberArguments } from './SRANDMEMBER';
|
||||
|
||||
export { FIRST_KEY_INDEX } from './SRANDMEMBER';
|
||||
// export { FIRST_KEY_INDEX } from './SRANDMEMBER';
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
count: number
|
||||
): RedisCommandArguments {
|
||||
return [
|
||||
...transformSRandMemberArguments(key),
|
||||
count.toString()
|
||||
];
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// count: number
|
||||
// ): RedisCommandArguments {
|
||||
// return [
|
||||
// ...transformSRandMemberArguments(key),
|
||||
// count.toString()
|
||||
// ];
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,13 +1,11 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { NumberReply, Command, RedisArgument } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
members: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(key: RedisArgument, members: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['SREM', key], members);
|
||||
}
|
||||
|
||||
export declare function transformReply(): number;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { RedisArgument, BlobStringReply, Command } from '../RESP/types';
|
||||
import { ScanOptions, pushScanArguments } from './generic-transformers';
|
||||
import { ScanCommonOptions, pushScanArguments } from './SCAN';
|
||||
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
@@ -7,7 +7,7 @@ export default {
|
||||
transformArguments(
|
||||
key: RedisArgument,
|
||||
cursor: number,
|
||||
options?: ScanOptions
|
||||
options?: ScanCommonOptions
|
||||
) {
|
||||
return pushScanArguments(['SSCAN', key], cursor, options);
|
||||
},
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
// export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
return pushVariadicArguments(['SUNION'], keys);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
// ): RedisCommandArguments {
|
||||
// return pushVariadicArguments(['SUNION'], keys);
|
||||
// }
|
||||
|
||||
export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
// export declare function transformReply(): Array<RedisCommandArgument>;
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
destination: RedisCommandArgument,
|
||||
keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
return pushVariadicArguments(['SUNIONSTORE', destination], keys);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// destination: RedisCommandArgument,
|
||||
// keys: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
// ): RedisCommandArguments {
|
||||
// return pushVariadicArguments(['SUNIONSTORE', destination], keys);
|
||||
// }
|
||||
|
||||
export declare function transformReply(): number;
|
||||
// export declare function transformReply(): number;
|
||||
|
@@ -1,12 +1,11 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(key: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['TOUCH'], key);
|
||||
}
|
||||
|
||||
export declare function transformReply(): number;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,12 +1,11 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { NumberReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments(key: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['UNLINK'], key);
|
||||
}
|
||||
|
||||
export declare function transformReply(): number;
|
||||
},
|
||||
transformReply: undefined as unknown as () => NumberReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,10 +1,11 @@
|
||||
import { RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
import { SimpleStringReply, Command } from '../RESP/types';
|
||||
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(key: string | Array<string>): RedisCommandArguments {
|
||||
export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: true,
|
||||
transformArguments(key: RedisVariadicArgument) {
|
||||
return pushVariadicArguments(['WATCH'], key);
|
||||
}
|
||||
|
||||
export declare function transformReply(): string;
|
||||
},
|
||||
transformReply: undefined as unknown as () => SimpleStringReply
|
||||
} as const satisfies Command;
|
||||
|
@@ -1,14 +1,14 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { pushVariadicArguments } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { pushVariadicArguments } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
group: RedisCommandArgument,
|
||||
id: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
): RedisCommandArguments {
|
||||
return pushVariadicArguments(['XACK', key, group], id);
|
||||
}
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// group: RedisCommandArgument,
|
||||
// id: RedisCommandArgument | Array<RedisCommandArgument>
|
||||
// ): RedisCommandArguments {
|
||||
// return pushVariadicArguments(['XACK', key, group], id);
|
||||
// }
|
||||
|
||||
export declare function transformReply(): number;
|
||||
// export declare function transformReply(): number;
|
||||
|
@@ -1,52 +1,52 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
interface XAddOptions {
|
||||
NOMKSTREAM?: true;
|
||||
TRIM?: {
|
||||
strategy?: 'MAXLEN' | 'MINID';
|
||||
strategyModifier?: '=' | '~';
|
||||
threshold: number;
|
||||
limit?: number;
|
||||
};
|
||||
}
|
||||
// interface XAddOptions {
|
||||
// NOMKSTREAM?: true;
|
||||
// TRIM?: {
|
||||
// strategy?: 'MAXLEN' | 'MINID';
|
||||
// strategyModifier?: '=' | '~';
|
||||
// threshold: number;
|
||||
// limit?: number;
|
||||
// };
|
||||
// }
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
id: RedisCommandArgument,
|
||||
message: Record<string, RedisCommandArgument>,
|
||||
options?: XAddOptions
|
||||
): RedisCommandArguments {
|
||||
const args = ['XADD', key];
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// id: RedisCommandArgument,
|
||||
// message: Record<string, RedisCommandArgument>,
|
||||
// options?: XAddOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['XADD', key];
|
||||
|
||||
if (options?.NOMKSTREAM) {
|
||||
args.push('NOMKSTREAM');
|
||||
}
|
||||
// if (options?.NOMKSTREAM) {
|
||||
// args.push('NOMKSTREAM');
|
||||
// }
|
||||
|
||||
if (options?.TRIM) {
|
||||
if (options.TRIM.strategy) {
|
||||
args.push(options.TRIM.strategy);
|
||||
}
|
||||
// if (options?.TRIM) {
|
||||
// if (options.TRIM.strategy) {
|
||||
// args.push(options.TRIM.strategy);
|
||||
// }
|
||||
|
||||
if (options.TRIM.strategyModifier) {
|
||||
args.push(options.TRIM.strategyModifier);
|
||||
}
|
||||
// if (options.TRIM.strategyModifier) {
|
||||
// args.push(options.TRIM.strategyModifier);
|
||||
// }
|
||||
|
||||
args.push(options.TRIM.threshold.toString());
|
||||
// args.push(options.TRIM.threshold.toString());
|
||||
|
||||
if (options.TRIM.limit) {
|
||||
args.push('LIMIT', options.TRIM.limit.toString());
|
||||
}
|
||||
}
|
||||
// if (options.TRIM.limit) {
|
||||
// args.push('LIMIT', options.TRIM.limit.toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
args.push(id);
|
||||
// args.push(id);
|
||||
|
||||
for (const [key, value] of Object.entries(message)) {
|
||||
args.push(key, value);
|
||||
}
|
||||
// for (const [key, value] of Object.entries(message)) {
|
||||
// args.push(key, value);
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
export declare function transformReply(): string;
|
||||
// export declare function transformReply(): string;
|
||||
|
@@ -1,39 +1,39 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { StreamMessagesReply, transformStreamMessagesReply } from './generic-transformers';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { StreamMessagesReply, transformStreamMessagesReply } from './generic-transformers';
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
// export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export interface XAutoClaimOptions {
|
||||
COUNT?: number;
|
||||
}
|
||||
// export interface XAutoClaimOptions {
|
||||
// COUNT?: number;
|
||||
// }
|
||||
|
||||
export function transformArguments(
|
||||
key: RedisCommandArgument,
|
||||
group: RedisCommandArgument,
|
||||
consumer: RedisCommandArgument,
|
||||
minIdleTime: number,
|
||||
start: string,
|
||||
options?: XAutoClaimOptions
|
||||
): RedisCommandArguments {
|
||||
const args = ['XAUTOCLAIM', key, group, consumer, minIdleTime.toString(), start];
|
||||
// export function transformArguments(
|
||||
// key: RedisCommandArgument,
|
||||
// group: RedisCommandArgument,
|
||||
// consumer: RedisCommandArgument,
|
||||
// minIdleTime: number,
|
||||
// start: string,
|
||||
// options?: XAutoClaimOptions
|
||||
// ): RedisCommandArguments {
|
||||
// const args = ['XAUTOCLAIM', key, group, consumer, minIdleTime.toString(), start];
|
||||
|
||||
if (options?.COUNT) {
|
||||
args.push('COUNT', options.COUNT.toString());
|
||||
}
|
||||
// if (options?.COUNT) {
|
||||
// args.push('COUNT', options.COUNT.toString());
|
||||
// }
|
||||
|
||||
return args;
|
||||
}
|
||||
// return args;
|
||||
// }
|
||||
|
||||
type XAutoClaimRawReply = [RedisCommandArgument, Array<any>];
|
||||
// type XAutoClaimRawReply = [RedisCommandArgument, Array<any>];
|
||||
|
||||
interface XAutoClaimReply {
|
||||
nextId: RedisCommandArgument;
|
||||
messages: StreamMessagesReply;
|
||||
}
|
||||
// interface XAutoClaimReply {
|
||||
// nextId: RedisCommandArgument;
|
||||
// messages: StreamMessagesReply;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: XAutoClaimRawReply): XAutoClaimReply {
|
||||
return {
|
||||
nextId: reply[0],
|
||||
messages: transformStreamMessagesReply(reply[1])
|
||||
};
|
||||
}
|
||||
// export function transformReply(reply: XAutoClaimRawReply): XAutoClaimReply {
|
||||
// return {
|
||||
// nextId: reply[0],
|
||||
// messages: transformStreamMessagesReply(reply[1])
|
||||
// };
|
||||
// }
|
||||
|
@@ -1,25 +1,25 @@
|
||||
import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
import { transformArguments as transformXAutoClaimArguments } from './XAUTOCLAIM';
|
||||
// import { RedisCommandArgument, RedisCommandArguments } from '.';
|
||||
// import { transformArguments as transformXAutoClaimArguments } from './XAUTOCLAIM';
|
||||
|
||||
export { FIRST_KEY_INDEX } from './XAUTOCLAIM';
|
||||
// export { FIRST_KEY_INDEX } from './XAUTOCLAIM';
|
||||
|
||||
export function transformArguments(...args: Parameters<typeof transformXAutoClaimArguments>): RedisCommandArguments {
|
||||
return [
|
||||
...transformXAutoClaimArguments(...args),
|
||||
'JUSTID'
|
||||
];
|
||||
}
|
||||
// export function transformArguments(...args: Parameters<typeof transformXAutoClaimArguments>): RedisCommandArguments {
|
||||
// return [
|
||||
// ...transformXAutoClaimArguments(...args),
|
||||
// 'JUSTID'
|
||||
// ];
|
||||
// }
|
||||
|
||||
type XAutoClaimJustIdRawReply = [RedisCommandArgument, Array<RedisCommandArgument>];
|
||||
// type XAutoClaimJustIdRawReply = [RedisCommandArgument, Array<RedisCommandArgument>];
|
||||
|
||||
interface XAutoClaimJustIdReply {
|
||||
nextId: RedisCommandArgument;
|
||||
messages: Array<RedisCommandArgument>;
|
||||
}
|
||||
// interface XAutoClaimJustIdReply {
|
||||
// nextId: RedisCommandArgument;
|
||||
// messages: Array<RedisCommandArgument>;
|
||||
// }
|
||||
|
||||
export function transformReply(reply: XAutoClaimJustIdRawReply): XAutoClaimJustIdReply {
|
||||
return {
|
||||
nextId: reply[0],
|
||||
messages: reply[1]
|
||||
};
|
||||
}
|
||||
// export function transformReply(reply: XAutoClaimJustIdRawReply): XAutoClaimJustIdReply {
|
||||
// return {
|
||||
// nextId: reply[0],
|
||||
// messages: reply[1]
|
||||
// };
|
||||
// }
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user