1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
This commit is contained in:
Leibale
2023-07-18 16:32:45 -04:00
parent 8501db0243
commit fdd1978d92
43 changed files with 377 additions and 506 deletions

View File

@@ -1,93 +1,96 @@
import * as ARRAPPEND from './ARRAPPEND';
import * as ARRINDEX from './ARRINDEX';
import * as ARRINSERT from './ARRINSERT';
import ARRAPPEND from './ARRAPPEND';
import ARRINDEX from './ARRINDEX';
import ARRINSERT from './ARRINSERT';
import CLEAR from './CLEAR';
import * as ARRLEN from './ARRLEN';
import * as ARRPOP from './ARRPOP';
import * as ARRTRIM from './ARRTRIM';
import * as DEBUG_MEMORY from './DEBUG_MEMORY';
import * as DEL from './DEL';
import * as FORGET from './FORGET';
import * as GET from './GET';
import * as MGET from './MGET';
import * as NUMINCRBY from './NUMINCRBY';
import * as NUMMULTBY from './NUMMULTBY';
import * as OBJKEYS from './OBJKEYS';
import * as OBJLEN from './OBJLEN';
import * as RESP from './RESP';
import * as SET from './SET';
import * as STRAPPEND from './STRAPPEND';
import * as STRLEN from './STRLEN';
import * as TYPE from './TYPE';
import ARRLEN from './ARRLEN';
// import ARRPOP from './ARRPOP';
import ARRTRIM from './ARRTRIM';
import DEBUG_MEMORY from './DEBUG_MEMORY';
import DEL from './DEL';
import FORGET from './FORGET';
// import GET from './GET';
// import MGET from './MGET';
import NUMINCRBY from './NUMINCRBY';
import NUMMULTBY from './NUMMULTBY';
import OBJKEYS from './OBJKEYS';
import OBJLEN from './OBJLEN';
// import RESP from './RESP';
import SET from './SET';
import STRAPPEND from './STRAPPEND';
import STRLEN from './STRLEN';
import TOGGLE from './TOGGLE';
// import TYPE from './TYPE';
export default {
ARRAPPEND,
arrAppend: ARRAPPEND,
ARRINDEX,
arrIndex: ARRINDEX,
ARRINSERT,
arrInsert: ARRINSERT,
CLEAR,
clear: CLEAR,
ARRLEN,
arrLen: ARRLEN,
ARRPOP,
arrPop: ARRPOP,
ARRTRIM,
arrTrim: ARRTRIM,
DEBUG_MEMORY,
debugMemory: DEBUG_MEMORY,
DEL,
del: DEL,
FORGET,
forget: FORGET,
GET,
get: GET,
MGET,
mGet: MGET,
NUMINCRBY,
numIncrBy: NUMINCRBY,
NUMMULTBY,
numMultBy: NUMMULTBY,
OBJKEYS,
objKeys: OBJKEYS,
OBJLEN,
objLen: OBJLEN,
RESP,
resp: RESP,
SET,
set: SET,
STRAPPEND,
strAppend: STRAPPEND,
STRLEN,
strLen: STRLEN,
TYPE,
type: TYPE
ARRAPPEND,
arrAppend: ARRAPPEND,
ARRINDEX,
arrIndex: ARRINDEX,
ARRINSERT,
arrInsert: ARRINSERT,
CLEAR,
clear: CLEAR,
ARRLEN,
arrLen: ARRLEN,
// ARRPOP,
// arrPop: ARRPOP,
ARRTRIM,
arrTrim: ARRTRIM,
DEBUG_MEMORY,
debugMemory: DEBUG_MEMORY,
DEL,
del: DEL,
FORGET,
forget: FORGET,
// GET,
// get: GET,
// MGET,
// mGet: MGET,
NUMINCRBY,
numIncrBy: NUMINCRBY,
NUMMULTBY,
numMultBy: NUMMULTBY,
OBJKEYS,
objKeys: OBJKEYS,
OBJLEN,
objLen: OBJLEN,
// RESP,
// resp: RESP,
SET,
set: SET,
STRAPPEND,
strAppend: STRAPPEND,
STRLEN,
strLen: STRLEN,
TOGGLE,
toggle: TOGGLE,
// TYPE,
// type: TYPE
};
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface RedisJSONArray extends Array<RedisJSON> {}
interface RedisJSONArray extends Array<RedisJSON> { }
interface RedisJSONObject {
[key: string]: RedisJSON;
[key: number]: RedisJSON;
[key: string]: RedisJSON;
[key: number]: RedisJSON;
}
export type RedisJSON = null | boolean | number | string | Date | RedisJSONArray | RedisJSONObject;
export function transformRedisJsonArgument(json: RedisJSON): string {
return JSON.stringify(json);
return JSON.stringify(json);
}
export function transformRedisJsonReply(json: string): RedisJSON {
return JSON.parse(json);
return JSON.parse(json);
}
export function transformRedisJsonNullReply(json: string | null): RedisJSON | null {
if (json === null) return null;
if (json === null) return null;
return transformRedisJsonReply(json);
return transformRedisJsonReply(json);
}
export function transformNumbersReply(reply: string): number | Array<number> {
return JSON.parse(reply);
return JSON.parse(reply);
}