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,4 +1,4 @@
import { RedisArgument, Command, ArrayReply, NumberReply, DoubleReply, NullReply } from '@redis/client/dist/lib/RESP/types';
import { RedisArgument, NumberReply, DoubleReply, NullReply, BlobStringReply, UnwrapReply, Command } from '@redis/client/dist/lib/RESP/types';
export default {
FIRST_KEY_INDEX: 1,
@@ -6,5 +6,10 @@ export default {
transformArguments(key: RedisArgument, path: RedisArgument, by: number) {
return ['JSON.NUMINCRBY', key, path, by.toString()];
},
transformReply: undefined as unknown as () => ArrayReply<NumberReply | DoubleReply | NullReply>
transformReply: {
2: (reply: UnwrapReply<BlobStringReply>) => {
return JSON.parse(reply.toString()) as number | Array<number>;
},
3: undefined as unknown as () => NumberReply | DoubleReply | NullReply
}
} as const satisfies Command;