You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
convert "resp types" to interfaces to allow circular references
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, SetReply, Command } from '../RESP/types';
|
||||
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, SetReply, UnwrapReply, Command } from '../RESP/types';
|
||||
|
||||
export type CommandGetKeysAndFlagsRawReply = ArrayReply<TuplesReply<[
|
||||
key: BlobStringReply,
|
||||
@@ -11,10 +11,13 @@ export default {
|
||||
transformArguments(args: Array<RedisArgument>) {
|
||||
return ['COMMAND', 'GETKEYSANDFLAGS', ...args];
|
||||
},
|
||||
transformReply(reply: CommandGetKeysAndFlagsRawReply) {
|
||||
return reply.map(([key, flags]) => ({
|
||||
key,
|
||||
flags
|
||||
}));
|
||||
transformReply(reply: UnwrapReply<CommandGetKeysAndFlagsRawReply>) {
|
||||
return reply.map(entry => {
|
||||
const [key, flags] = entry as unknown as UnwrapReply<typeof entry>;
|
||||
return {
|
||||
key,
|
||||
flags
|
||||
};
|
||||
});
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user