You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix graph
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { RedisArgument, Command, ArrayReply, BlobStringReply, NumberReply, NullReply, TuplesReply } from '@redis/client/dist/lib/RESP/types';
|
||||
import { RedisArgument, ArrayReply, BlobStringReply, NumberReply, NullReply, TuplesReply, UnwrapReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
type Headers = ArrayReply<BlobStringReply>;
|
||||
|
||||
@@ -89,7 +89,7 @@ export default {
|
||||
FIRST_KEY_INDEX: 1,
|
||||
IS_READ_ONLY: false,
|
||||
transformArguments: transformQueryArguments.bind(undefined, 'GRAPH.QUERY'),
|
||||
transformReply(reply: QueryRawReply) {
|
||||
transformReply(reply: UnwrapReply<QueryRawReply>) {
|
||||
return reply.length === 1 ? {
|
||||
headers: undefined,
|
||||
data: undefined,
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, UnwrapReply, Command } from '@redis/client/dist/lib/RESP/types';
|
||||
|
||||
type SlowLogRawReply = ArrayReply<TuplesReply<[
|
||||
timestamp: BlobStringReply,
|
||||
@@ -13,12 +13,15 @@ export default {
|
||||
transformArguments(key: RedisArgument) {
|
||||
return ['GRAPH.SLOWLOG', key];
|
||||
},
|
||||
transformReply(reply: SlowLogRawReply) {
|
||||
return reply.map(([timestamp, command, query, took]) => ({
|
||||
timestamp: Number(timestamp),
|
||||
command,
|
||||
query,
|
||||
took: Number(took)
|
||||
}));
|
||||
transformReply(reply: UnwrapReply<SlowLogRawReply>) {
|
||||
return reply.map(log => {
|
||||
const [timestamp, command, query, took] = log as unknown as UnwrapReply<typeof log>;
|
||||
return {
|
||||
timestamp: Number(timestamp),
|
||||
command,
|
||||
query,
|
||||
took: Number(took)
|
||||
};
|
||||
});
|
||||
}
|
||||
} as const satisfies Command;
|
||||
|
Reference in New Issue
Block a user