1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

buffers, buffers everywhere...

This commit is contained in:
leibale
2021-12-20 14:47:51 -05:00
parent 2733e225ae
commit a0de7967f9
237 changed files with 2322 additions and 1951 deletions

View File

@@ -1,5 +1,7 @@
export function transformArguments(categoryName?: string): Array<string> {
const args = ['ACL', 'CAT'];
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(categoryName?: RedisCommandArgument): RedisCommandArguments {
const args: RedisCommandArguments = ['ACL', 'CAT'];
if (categoryName) {
args.push(categoryName);
@@ -8,4 +10,4 @@ export function transformArguments(categoryName?: string): Array<string> {
return args;
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,8 +1,10 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export function transformArguments(username: string | Array<string>): RedisCommandArguments {
export function transformArguments(
username: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['ACL', 'DELUSER'], username);
}
export declare const transformReply: (reply: number) => number;
export declare function transformReply(): number;

View File

@@ -1,4 +1,6 @@
export function transformArguments(bits?: number): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(bits?: number): RedisCommandArguments {
const args = ['ACL', 'GENPASS'];
if (bits) {
@@ -8,4 +10,4 @@ export function transformArguments(bits?: number): Array<string> {
return args;
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,26 +1,28 @@
export function transformArguments(username: string): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(username: RedisCommandArgument): RedisCommandArguments {
return ['ACL', 'GETUSER', username];
}
type AclGetUserRawReply = [
_: string,
flags: Array<string>,
_: string,
passwords: Array<string>,
_: string,
commands: string,
_: string,
keys: Array<string>,
_: string,
channels: Array<string>
_: RedisCommandArgument,
flags: Array<RedisCommandArgument>,
_: RedisCommandArgument,
passwords: Array<RedisCommandArgument>,
_: RedisCommandArgument,
commands: RedisCommandArgument,
_: RedisCommandArgument,
keys: Array<RedisCommandArgument>,
_: RedisCommandArgument,
channels: Array<RedisCommandArgument>
];
interface AclUser {
flags: Array<string>;
passwords: Array<string>;
commands: string;
keys: Array<string>;
channels: Array<string>
flags: Array<RedisCommandArgument>;
passwords: Array<RedisCommandArgument>;
commands: RedisCommandArgument;
keys: Array<RedisCommandArgument>;
channels: Array<RedisCommandArgument>
}
export function transformReply(reply: AclGetUserRawReply): AclUser {

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ACL', 'LIST'];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ACL', 'LOAD'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,4 +1,6 @@
export function transformArguments(count?: number): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(count?: number): RedisCommandArguments {
const args = ['ACL', 'LOG'];
if (count) {
@@ -9,30 +11,30 @@ export function transformArguments(count?: number): Array<string> {
}
type AclLogRawReply = [
_: string,
_: RedisCommandArgument,
count: number,
_: string,
reason: string,
_: string,
context: string,
_: string,
object: string,
_: string,
username: string,
_: string,
ageSeconds: string,
_: string,
clientInfo: string
_: RedisCommandArgument,
reason: RedisCommandArgument,
_: RedisCommandArgument,
context: RedisCommandArgument,
_: RedisCommandArgument,
object: RedisCommandArgument,
_: RedisCommandArgument,
username: RedisCommandArgument,
_: RedisCommandArgument,
ageSeconds: RedisCommandArgument,
_: RedisCommandArgument,
clientInfo: RedisCommandArgument
];
interface AclLog {
count: number;
reason: string;
context: string;
object: string;
username: string;
reason: RedisCommandArgument;
context: RedisCommandArgument;
object: RedisCommandArgument;
username: RedisCommandArgument;
ageSeconds: number;
clientInfo: string;
clientInfo: RedisCommandArgument;
}
export function transformReply(reply: Array<AclLogRawReply>): Array<AclLog> {

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ACL', 'LOG', 'RESET'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ACL', 'SAVE'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,8 +1,11 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export function transformArguments(username: string, rule: string | Array<string>): RedisCommandArguments {
export function transformArguments(
username: RedisCommandArgument,
rule: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['ACL', 'SETUSER', username], rule);
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ACL', 'USERS'];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ACL', 'WHOAMI'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArguments, RedisCommandArgument } from '.';
export function transformArguments(): RedisCommandArguments {
return ['ASKING'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,9 +1,11 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export interface AuthOptions {
username?: string;
password: string;
username?: RedisCommandArgument;
password: RedisCommandArgument;
}
export function transformArguments({username, password}: AuthOptions): Array<string> {
export function transformArguments({ username, password }: AuthOptions): RedisCommandArguments {
if (!username) {
return ['AUTH', password];
}
@@ -11,4 +13,4 @@ export function transformArguments({username, password}: AuthOptions): Array<str
return ['AUTH', username, password];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,5 +1,7 @@
export function transformArguments(): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(): RedisCommandArguments {
return ['BGREWRITEAOF'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,8 +1,10 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
interface BgSaveOptions {
SCHEDULE?: true;
}
export function transformArguments(options?: BgSaveOptions): Array<string> {
export function transformArguments(options?: BgSaveOptions): RedisCommandArguments {
const args = ['BGSAVE'];
if (options?.SCHEDULE) {
@@ -12,4 +14,4 @@ export function transformArguments(options?: BgSaveOptions): Array<string> {
return args;
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,3 +1,5 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
@@ -7,7 +9,10 @@ interface BitCountRange {
end: number;
}
export function transformArguments(key: string, range?: BitCountRange): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
range?: BitCountRange
): RedisCommandArguments {
const args = ['BITCOUNT', key];
if (range) {

View File

@@ -1,11 +1,15 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 2;
type BitOperations = 'AND' | 'OR' | 'XOR' | 'NOT';
export function transformArguments(operation: BitOperations, destKey: string, key: string | Array<string>): RedisCommandArguments {
export function transformArguments(
operation: BitOperations,
destKey: RedisCommandArgument,
key: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['BITOP', operation, destKey], key);
}

View File

@@ -1,10 +1,16 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { BitValue } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, bit: BitValue, start?: number, end?: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
bit: BitValue,
start?: number,
end?: number
): RedisCommandArguments {
const args = ['BITPOS', key, bit.toString()];
if (typeof start === 'number') {

View File

@@ -20,4 +20,4 @@ export function transformArguments(
];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,5 +0,0 @@
export { FIRST_KEY_INDEX, transformArguments } from './BLMOVE';
export const BUFFER_MODE = true;
export declare function transformReply(): Buffer | null;

View File

@@ -14,12 +14,14 @@ export function transformArguments(
return args;
}
type BLPopRawReply = null | [RedisCommandArgument, RedisCommandArgument];
type BLPopReply = null | {
key: string;
element: string;
key: RedisCommandArgument;
element: RedisCommandArgument;
};
export function transformReply(reply: null | [string, string]): BLPopReply {
export function transformReply(reply: BLPopRawReply): BLPopReply {
if (reply === null) return null;
return {

View File

@@ -1,17 +0,0 @@
export { FIRST_KEY_INDEX, transformArguments } from './BLPOP';
export const BUFFER_MODE = true;
type BLPopBufferReply = null | {
key: Buffer;
element: Buffer;
};
export function transformReply(reply: null | [Buffer, Buffer]): BLPopBufferReply {
if (reply === null) return null;
return {
key: reply[0],
element: reply[1]
};
}

View File

@@ -1,9 +1,12 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string | Array<string>, timeout: number): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument | Array<RedisCommandArgument>,
timeout: number
): RedisCommandArguments {
const args = pushVerdictArguments(['BRPOP'], key);
args.push(timeout.toString());

View File

@@ -10,4 +10,4 @@ export function transformArguments(
return ['BRPOPLPUSH', source, destination, timeout.toString()];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,5 +0,0 @@
export { FIRST_KEY_INDEX, transformArguments } from './BRPOPLPUSH';
export const BUFFER_MODE = true;
export declare function transformReply(): Buffer | null;

View File

@@ -1,3 +0,0 @@
export { FIRST_KEY_INDEX, transformArguments } from './BRPOP';
export { BUFFER_MODE, transformReply } from './BLPOP_BUFFER';

View File

@@ -1,5 +1,5 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers';
import { pushVerdictArguments, transformNumberInfinityReply, ZMember } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
@@ -14,18 +14,16 @@ export function transformArguments(
return args;
}
interface ZMemberWithKey extends ZMember<string> {
key: string;
}
type ZMemberRawReply = [key: RedisCommandArgument, value: RedisCommandArgument, score: RedisCommandArgument] | null;
type BZPopMaxReply = ZMemberWithKey | null;
type BZPopMaxReply = (ZMember & { key: RedisCommandArgument }) | null;
export function transformReply(reply: [key: string, value: string, score: string] | null): BZPopMaxReply | null {
export function transformReply(reply: ZMemberRawReply): BZPopMaxReply | null {
if (!reply) return null;
return {
key: reply[0],
value: reply[1],
score: transformReplyNumberInfinity(reply[2])
score: transformNumberInfinityReply(reply[2])
};
}

View File

@@ -1,9 +1,12 @@
import { RedisCommandArguments } from '.';
import { pushVerdictArguments, transformReplyNumberInfinity, ZMember } from './generic-transformers';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string | Array<string>, timeout: number): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument | Array<RedisCommandArgument>,
timeout: number
): RedisCommandArguments {
const args = pushVerdictArguments(['BZPOPMIN'], key);
args.push(timeout.toString());
@@ -11,18 +14,4 @@ export function transformArguments(key: string | Array<string>, timeout: number)
return args;
}
interface ZMemberWithKey extends ZMember<string> {
key: string;
}
type BZPopMinReply = ZMemberWithKey | null;
export function transformReply(reply: [key: string, value: string, score: string] | null): BZPopMinReply | null {
if (!reply) return null;
return {
key: reply[0],
value: reply[1],
score: transformReplyNumberInfinity(reply[2])
};
}
export { transformReply } from './BZPOPMAX';

View File

@@ -8,4 +8,4 @@ export function transformArguments(value: boolean): RedisCommandArguments {
];
}
export declare function transformReply(): 'OK';
export declare function transformReply(): 'OK' | Buffer;

View File

@@ -1,7 +1,7 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(name: string): RedisCommandArguments {
export function transformArguments(name: RedisCommandArgument): RedisCommandArguments {
return ['CLIENT', 'SETNAME', name];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,9 +1,9 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const IS_READ_ONLY = true;
export function transformArguments(args: Array<string>): RedisCommandArguments {
export function transformArguments(args: Array<RedisCommandArgument>): RedisCommandArguments {
return ['COMMAND', 'GETKEYS', ...args];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -2,4 +2,4 @@ export function transformArguments(parameter: string): Array<string> {
return ['CONFIG', 'GET', parameter];
}
export { transformReplyStringTuples as transformReply } from './generic-transformers';
export { transformTuplesReply as transformReply } from './generic-transformers';

View File

@@ -1,3 +1,5 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
interface CopyCommandOptions {
destinationDb?: number;
replace?: boolean;
@@ -5,7 +7,11 @@ interface CopyCommandOptions {
export const FIRST_KEY_INDEX = 1;
export function transformArguments(source: string, destination: string, options?: CopyCommandOptions): Array<string> {
export function transformArguments(
source: RedisCommandArgument,
destination: RedisCommandArgument,
options?: CopyCommandOptions
): RedisCommandArguments {
const args = ['COPY', source, destination];
if (options?.destinationDb) {
@@ -19,4 +25,4 @@ export function transformArguments(source: string, destination: string, options?
return args;
}
export { transformReplyBoolean as transformReply } from './generic-transformers';
export { transformBooleanReply as transformReply } from './generic-transformers';

View File

@@ -1,6 +1,8 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['DECR', key];
}

View File

@@ -1,6 +1,11 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, decrement: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
decrement: number
): RedisCommandArguments {
return ['DECRBY', key, decrement.toString()];
}

View File

@@ -1,7 +1,9 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export function transformArguments(keys: string | Array<string>): RedisCommandArguments {
export function transformArguments(
keys: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['DEL'], keys);
}

View File

@@ -1,5 +1,7 @@
import { RedisCommandArgument } from '.';
export function transformArguments(): Array<string> {
return ['DISCARD'];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,5 +1,7 @@
export function transformArguments(key: string): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['DUMP', key];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,7 +1,9 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const IS_READ_ONLY = true;
export function transformArguments(message: string): Array<string> {
export function transformArguments(message: RedisCommandArgument): RedisCommandArguments {
return ['ECHO', message];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,12 +1,14 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(keys: string | Array<string>): RedisCommandArguments {
export function transformArguments(
keys: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['EXISTS'], keys);
}
export { transformReplyBoolean as transformReply } from './generic-transformers';
export { transformBooleanReply as transformReply } from './generic-transformers';

View File

@@ -1,5 +1,12 @@
export function transformArguments(key: string, seconds: number): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(
key: RedisCommandArgument,
seconds: number
): RedisCommandArguments {
return ['EXPIRE', key, seconds.toString()];
}
export { transformReplyBoolean as transformReply } from './generic-transformers';
export { transformBooleanReply as transformReply } from './generic-transformers';

View File

@@ -1,6 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { transformEXAT } from './generic-transformers';
export function transformArguments(key: string, timestamp: number | Date): Array<string> {
export const FIRST_KEY_INDEX = 1;
export function transformArguments(
key: RedisCommandArgument,
timestamp: number | Date
): RedisCommandArguments {
return [
'EXPIREAT',
key,
@@ -8,4 +14,4 @@ export function transformArguments(key: string, timestamp: number | Date): Array
];
}
export { transformReplyBoolean as transformReply } from './generic-transformers';
export { transformBooleanReply as transformReply } from './generic-transformers';

View File

@@ -1,7 +1,8 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { GeoCoordinates } from './generic-transformers';
interface GeoMember extends GeoCoordinates {
member: string;
member: RedisCommandArgument;
}
interface NX {
@@ -22,7 +23,10 @@ type GeoAddOptions = SetGuards & GeoAddCommonOptions;
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, toAdd: GeoMember | Array<GeoMember>, options?: GeoAddOptions): Array<string> {
export function transformArguments(
key: RedisCommandArgument, toAdd: GeoMember | Array<GeoMember>,
options?: GeoAddOptions
): RedisCommandArguments {
const args = ['GEOADD', key];
if ((options as NX)?.NX) {

View File

@@ -1,3 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { GeoUnits } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
@@ -5,11 +6,11 @@ export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(
key: string,
member1: string,
member2: string,
key: RedisCommandArgument,
member1: RedisCommandArgument,
member2: RedisCommandArgument,
unit?: GeoUnits
): Array<string> {
): RedisCommandArguments {
const args = ['GEODIST', key, member1, member2];
if (unit) {
@@ -19,6 +20,6 @@ export function transformArguments(
return args;
}
export function transformReply(reply: string | null): number | null {
export function transformReply(reply: RedisCommandArgument | null): number | null {
return reply === null ? null : Number(reply);
}

View File

@@ -1,12 +1,15 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, member: string | Array<string>): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
member: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['GEOHASH', key], member);
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,20 +1,25 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, member: string | Array<string>): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
member: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['GEOPOS', key], member);
}
type GeoCoordinatesRawReply = Array<[RedisCommandArgument, RedisCommandArgument] | null>;
interface GeoCoordinates {
longitude: string;
latitude: string;
longitude: RedisCommandArgument;
latitude: RedisCommandArgument;
}
export function transformReply(reply: Array<[string, string] | null>): Array<GeoCoordinates | null> {
export function transformReply(reply: GeoCoordinatesRawReply): Array<GeoCoordinates | null> {
return reply.map(coordinates => coordinates === null ? null : {
longitude: coordinates[0],
latitude: coordinates[1]

View File

@@ -1,3 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
@@ -5,12 +6,12 @@ export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(
key: string,
key: RedisCommandArgument,
from: GeoSearchFrom,
by: GeoSearchBy,
options?: GeoSearchOptions
): Array<string> {
): RedisCommandArguments {
return pushGeoSearchArguments(['GEOSEARCH'], key, from, by, options);
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,3 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { GeoSearchFrom, GeoSearchBy, GeoSearchOptions, pushGeoSearchArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
@@ -9,12 +10,12 @@ interface GeoSearchStoreOptions extends GeoSearchOptions {
}
export function transformArguments(
destination: string,
source: string,
destination: RedisCommandArgument,
source: RedisCommandArgument,
from: GeoSearchFrom,
by: GeoSearchBy,
options?: GeoSearchStoreOptions
): Array<string> {
): RedisCommandArguments {
const args = pushGeoSearchArguments(
['GEOSEARCHSTORE', destination],
source,

View File

@@ -1,11 +1,11 @@
import { RedisCommandArguments } from '.';
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 function transformArguments(
key: string,
key: RedisCommandArgument,
from: GeoSearchFrom,
by: GeoSearchBy,
replyWith: Array<GeoReplyWith>,

View File

@@ -1,4 +1,5 @@
import { strict as assert } from 'assert';
import RedisClient from '../client';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './GET';
@@ -11,6 +12,12 @@ describe('GET', () => {
});
testUtils.testWithClient('client.get', async client => {
const a = await client.get(
'key'
);
assert.equal(
await client.get('key'),
null

View File

@@ -8,4 +8,4 @@ export function transformArguments(key: RedisCommandArgument): RedisCommandArgum
return ['GET', key];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,10 +1,14 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { BitValue } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, offset: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
offset: number
): RedisCommandArguments {
return ['GETBIT', key, offset.toString()];
}

View File

@@ -1,7 +1,9 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['GETDEL', key];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,4 +1,4 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { transformEXAT, transformPXAT } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
@@ -15,7 +15,10 @@ type GetExModes = {
PERSIST: true;
};
export function transformArguments(key: string, mode: GetExModes): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
mode: GetExModes
): RedisCommandArguments {
const args = ['GETEX', key];
if ('EX' in mode) {
@@ -33,4 +36,4 @@ export function transformArguments(key: string, mode: GetExModes): RedisCommandA
return args;
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,9 +1,15 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, start: number, end: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
start: number,
end: number
): RedisCommandArguments {
return ['GETRANGE', key, start.toString(), end.toString()];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,7 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, value: string): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
value: RedisCommandArgument
): RedisCommandArguments {
return ['GETSET', key, value];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,22 +0,0 @@
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
describe('GET_BUFFER', () => {
testUtils.testWithClient('client.getBuffer', async client => {
const buffer = Buffer.from('string');
await client.set('key', buffer);
assert.deepEqual(
buffer,
await client.getBuffer('key')
);
}, GLOBAL.SERVERS.OPEN);
testUtils.testWithCluster('cluster.getBuffer', async cluster => {
const buffer = Buffer.from('string');
await cluster.set('key', buffer);
assert.deepEqual(
buffer,
await cluster.getBuffer('key')
);
}, GLOBAL.CLUSTERS.OPEN);
});

View File

@@ -1,5 +0,0 @@
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './GET';
export const BUFFER_MODE = true;
export declare function transformReply(): Buffer | null;

View File

@@ -1,9 +1,12 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, field: string | Array<string>): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
field: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['HDEL', key], field);
}

View File

@@ -1,3 +1,4 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { AuthOptions } from './AUTH';
interface HelloOptions {
@@ -6,8 +7,8 @@ interface HelloOptions {
clientName?: string;
}
export function transformArguments(options?: HelloOptions): Array<string> {
const args = ['HELLO'];
export function transformArguments(options?: HelloOptions): RedisCommandArguments {
const args: RedisCommandArguments = ['HELLO'];
if (options) {
args.push(options.protover.toString());
@@ -26,29 +27,29 @@ export function transformArguments(options?: HelloOptions): Array<string> {
type HelloRawReply = [
_: never,
server: string,
server: RedisCommandArgument,
_: never,
version: string,
version: RedisCommandArgument,
_: never,
proto: number,
_: never,
id: number,
_: never,
mode: string,
mode: RedisCommandArgument,
_: never,
role: string,
role: RedisCommandArgument,
_: never,
modules: Array<string>
modules: Array<RedisCommandArgument>
];
interface HelloTransformedReply {
server: string;
version: string;
server: RedisCommandArgument;
version: RedisCommandArgument;
proto: number;
id: number;
mode: string;
role: string;
modules: Array<string>;
mode: RedisCommandArgument;
role: RedisCommandArgument;
modules: Array<RedisCommandArgument>;
}
export function transformReply(reply: HelloRawReply): HelloTransformedReply {

View File

@@ -1,7 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, field: string): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
field: RedisCommandArgument
): RedisCommandArguments {
return ['HEXISTS', key, field];
}
export { transformReplyBoolean as transformReply } from './generic-transformers';
export { transformBooleanReply as transformReply } from './generic-transformers';

View File

@@ -11,4 +11,4 @@ export function transformArguments(
return ['HGET', key, field];
}
export declare function transformReply(): string | undefined;
export declare function transformReply(): RedisCommandArgument | undefined;

View File

@@ -1,9 +1,11 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['HGETALL', key];
}
export { transformReplyStringTuples as transformReply } from './generic-transformers';
export { transformTuplesReply as transformReply } from './generic-transformers';

View File

@@ -1,5 +0,0 @@
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './HGETALL';
export const BUFFER_MODE = true;
export { transformReplyBufferTuples as transformReply } from './generic-transformers';

View File

@@ -1,5 +0,0 @@
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './HGET';
export const BUFFER_MODE = true;
export declare function transformReply(): Buffer | undefined;

View File

@@ -1,6 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, field: string, increment: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
field: RedisCommandArgument,
increment: number
): RedisCommandArguments {
return ['HINCRBY', key, field, increment.toString()];
}

View File

@@ -1,6 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, field: string, increment: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
field: RedisCommandArgument,
increment: number
): RedisCommandArguments {
return ['HINCRBYFLOAT', key, field, increment.toString()];
}

View File

@@ -1,7 +1,9 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['HKEYS', key];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,6 +1,8 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['HLEN', key];
}

View File

@@ -1,12 +1,15 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, fields: string | Array<string>): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
fields: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['HMGET', key], fields);
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,9 +1,11 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['HRANDFIELD', key];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,12 +1,16 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { transformArguments as transformHRandFieldArguments } from './HRANDFIELD';
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './HRANDFIELD';
export function transformArguments(key: string, count: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
count: number
): RedisCommandArguments {
return [
...transformHRandFieldArguments(key),
count.toString()
];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,12 +1,16 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { transformArguments as transformHRandFieldCountArguments } from './HRANDFIELD_COUNT';
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './HRANDFIELD_COUNT';
export function transformArguments(key: string, count: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
count: number
): RedisCommandArguments {
return [
...transformHRandFieldCountArguments(key, count),
'WITHVALUES'
];
}
export { transformReplyStringTuples as transformReply } from './generic-transformers';
export { transformTuplesReply as transformReply } from './generic-transformers';

View File

@@ -1,5 +0,0 @@
export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './HRANDFIELD_COUNT';
export const BUFFER_MODE = true;
export { transformReplyBufferTuples as transformReply } from './generic-transformers';

View File

@@ -1,19 +1,26 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { ScanOptions, pushScanArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, cursor: number, options?: ScanOptions): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
cursor: number,
options?: ScanOptions
): RedisCommandArguments {
return pushScanArguments([
'HSCAN',
key
], cursor, options);
}
type HScanRawReply = [RedisCommandArgument, Array<RedisCommandArgument>];
export interface HScanTuple {
field: string;
value: string;
field: RedisCommandArgument;
value: RedisCommandArgument;
}
interface HScanReply {
@@ -21,7 +28,7 @@ interface HScanReply {
tuples: Array<HScanTuple>;
}
export function transformReply([cursor, rawTuples]: [string, Array<string>]): HScanReply {
export function transformReply([cursor, rawTuples]: HScanRawReply): HScanReply {
const parsedTuples = [];
for (let i = 0; i < rawTuples.length; i += 2) {
parsedTuples.push({

View File

@@ -1,6 +1,6 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
type Types = string | number | Buffer;
type Types = RedisCommandArgument | number;
type HSETObject = Record<string | number, Types>;

View File

@@ -1,7 +1,13 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, field: string, value: string): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
field: RedisCommandArgument,
value: RedisCommandArgument
): RedisCommandArguments {
return ['HSETNX', key, field, value];
}
export { transformReplyBoolean as transformReply } from './generic-transformers';
export { transformBooleanReply as transformReply } from './generic-transformers';

View File

@@ -1,6 +1,11 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, field: string): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
field: RedisCommandArgument
): RedisCommandArguments {
return ['HSTRLEN', key, field];
}

View File

@@ -1,7 +1,9 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['HVALS', key];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,6 +1,8 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['INCR', key];
}

View File

@@ -1,6 +1,11 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, increment: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
increment: number
): RedisCommandArguments {
return ['INCRBY', key, increment.toString()];
}

View File

@@ -1,7 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, increment: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
increment: number
): RedisCommandArguments {
return ['INCRBYFLOAT', key, increment.toString()];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,7 +1,7 @@
export function transformArguments(pattern: string): Array<string> {
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformArguments(pattern: RedisCommandArgument): RedisCommandArguments {
return ['KEYS', pattern];
}
export function transformReply(keys: Array<string>): Array<string> {
return keys;
}
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,8 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const IS_READ_ONLY = true;
export function transformArguments(key: string, index: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
index: number
): RedisCommandArguments {
return ['LINDEX', key, index.toString()];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,13 +1,15 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
type LInsertPosition = 'BEFORE' | 'AFTER';
export function transformArguments(
key: string,
key: RedisCommandArgument,
position: LInsertPosition,
pivot: string,
element: string
): Array<string> {
pivot: RedisCommandArgument,
element: RedisCommandArgument
): RedisCommandArguments {
return [
'LINSERT',
key,

View File

@@ -1,8 +1,10 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['LLEN', key];
}

View File

@@ -1,13 +1,15 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export type LMoveSide = 'LEFT' | 'RIGHT';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(
source: string,
destination: string,
source: RedisCommandArgument,
destination: RedisCommandArgument,
sourceSide: LMoveSide,
destinationSide: LMoveSide
): Array<string> {
): RedisCommandArguments {
return [
'LMOVE',
source,
@@ -17,4 +19,4 @@ export function transformArguments(
];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,3 +1,5 @@
import { RedisCommandArgument } from '.';
export const IS_READ_ONLY = true;
export function transformArguments(version?: number, ...optionalArguments: Array<number>): Array<string> {
@@ -14,4 +16,4 @@ export function transformArguments(version?: number, ...optionalArguments: Array
return args;
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,7 +1,9 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string): Array<string> {
export function transformArguments(key: RedisCommandArgument): RedisCommandArguments {
return ['LPOP', key];
}
export declare function transformReply(): string | null;
export declare function transformReply(): RedisCommandArgument | null;

View File

@@ -1,7 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, count: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
count: number
): RedisCommandArguments {
return ['LPOP', key, count.toString()];
}
export declare function transformReply(): Array<string> | null;
export declare function transformReply(): Array<RedisCommandArgument> | null;

View File

@@ -1,3 +1,5 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
@@ -7,7 +9,11 @@ export interface LPosOptions {
MAXLEN?: number;
}
export function transformArguments(key: string, element: string, options?: LPosOptions): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
element: RedisCommandArgument,
options?: LPosOptions
): RedisCommandArguments {
const args = ['LPOS', key, element];
if (typeof options?.RANK === 'number') {

View File

@@ -1,8 +1,14 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { LPosOptions } from './LPOS';
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './LPOS';
export function transformArguments(key: string, element: string, count: number, options?: LPosOptions): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
element: RedisCommandArgument,
count: number,
options?: LPosOptions
): RedisCommandArguments {
const args = ['LPOS', key, element];
if (typeof options?.RANK === 'number') {

View File

@@ -1,9 +1,12 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, elements: string | Array<string>): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
elements: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['LPUSH', key], elements);}
export declare function transformReply(): number;

View File

@@ -1,9 +1,12 @@
import { RedisCommandArguments } from '.';
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { pushVerdictArguments } from './generic-transformers';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, element: string | Array<string>): RedisCommandArguments {
export function transformArguments(
key: RedisCommandArgument,
element: RedisCommandArgument | Array<RedisCommandArgument>
): RedisCommandArguments {
return pushVerdictArguments(['LPUSHX', key], element);
}

View File

@@ -1,8 +1,14 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(key: string, start: number, stop: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
start: number,
stop: number
): RedisCommandArguments {
return [
'LRANGE',
key,
@@ -11,4 +17,4 @@ export function transformArguments(key: string, start: number, stop: number): Ar
];
}
export declare function transformReply(): Array<string>;
export declare function transformReply(): Array<RedisCommandArgument>;

View File

@@ -1,6 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, count: number, element: string): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
count: number,
element: RedisCommandArgument
): RedisCommandArguments {
return [
'LREM',
key,

View File

@@ -1,6 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, index: number, element: string): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
index: number,
element: RedisCommandArgument
): RedisCommandArguments {
return [
'LSET',
key,
@@ -9,4 +15,4 @@ export function transformArguments(key: string, index: number, element: string):
];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,6 +1,12 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export function transformArguments(key: string, start: number, stop: number): Array<string> {
export function transformArguments(
key: RedisCommandArgument,
start: number,
stop: number
): RedisCommandArguments {
return [
'LTRIM',
key,
@@ -9,4 +15,4 @@ export function transformArguments(key: string, start: number, stop: number): Ar
];
}
export declare function transformReply(): string;
export declare function transformReply(): RedisCommandArgument;

View File

@@ -1,9 +1,13 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
export function transformArguments(keys: Array<string>): Array<string> {
export function transformArguments(
keys: Array<RedisCommandArgument>
): RedisCommandArguments {
return ['MGET', ...keys];
}
export declare function transformReply(): Array<string | null>;
export declare function transformReply(): Array<RedisCommandArgument | null>;

Some files were not shown because too many files have changed in this diff Show More