-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new "transform arguments" API for better key and metadata extraction (#…
…2733) * Parser support with all commands * remove "dist" from all imports for consistency * address most of my review comments * small tweak to multi type mapping handling * tweak multi commands / fix addScript cases * nits * addressed all in person review comments * revert addCommand/addScript changes to multi-commands addCommand needs to be there for sendCommand like ability within a multi. If its there, it might as well be used by createCommand() et al, to avoid repeating code. addScript is there (even though only used once), but now made private to keep the logic for bookkeeping near each other.
- Loading branch information
Showing
1,016 changed files
with
6,345 additions
and
6,540 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; | ||
import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; | ||
import { CommandParser } from '@redis/client/lib/client/parser'; | ||
import { RedisArgument, Command } from '@redis/client/lib/RESP/types'; | ||
import { transformBooleanReply } from '@redis/client/lib/commands/generic-transformers'; | ||
|
||
export default { | ||
FIRST_KEY_INDEX: 1, | ||
IS_READ_ONLY: false, | ||
transformArguments(key: RedisArgument, item: RedisArgument) { | ||
return ['BF.ADD', key, item]; | ||
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { | ||
parser.push('BF.ADD'); | ||
parser.pushKey(key); | ||
parser.push(item); | ||
}, | ||
transformReply: transformBooleanReply | ||
} as const satisfies Command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { RedisArgument, NumberReply, Command } from '@redis/client/dist/lib/RESP/types'; | ||
import { CommandParser } from '@redis/client/lib/client/parser'; | ||
import { RedisArgument, NumberReply, Command } from '@redis/client/lib/RESP/types'; | ||
|
||
export default { | ||
FIRST_KEY_INDEX: 1, | ||
IS_READ_ONLY: true, | ||
transformArguments(key: RedisArgument) { | ||
return ['BF.CARD', key]; | ||
parseCommand(parser: CommandParser, key: RedisArgument) { | ||
parser.push('BF.CARD'); | ||
parser.pushKey(key); | ||
}, | ||
transformReply: undefined as unknown as () => NumberReply | ||
} as const satisfies Command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; | ||
import { transformBooleanReply } from '@redis/client/dist/lib/commands/generic-transformers'; | ||
import { CommandParser } from '@redis/client/lib/client/parser'; | ||
import { RedisArgument, Command } from '@redis/client/lib/RESP/types'; | ||
import { transformBooleanReply } from '@redis/client/lib/commands/generic-transformers'; | ||
|
||
export default { | ||
FIRST_KEY_INDEX: 1, | ||
IS_READ_ONLY: true, | ||
transformArguments(key: RedisArgument, item: RedisArgument) { | ||
return ['BF.EXISTS', key, item]; | ||
parseCommand(parser: CommandParser, key: RedisArgument, item: RedisArgument) { | ||
parser.push('BF.EXISTS'); | ||
parser.pushKey(key); | ||
parser.push(item); | ||
}, | ||
transformReply: transformBooleanReply | ||
} as const satisfies Command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/lib/RESP/types'; | ||
import { CommandParser } from '@redis/client/lib/client/parser'; | ||
import { RedisArgument, SimpleStringReply, Command } from '@redis/client/lib/RESP/types'; | ||
|
||
export default { | ||
FIRST_KEY_INDEX: 1, | ||
IS_READ_ONLY: false, | ||
transformArguments(key: RedisArgument, iterator: number, chunk: RedisArgument) { | ||
return ['BF.LOADCHUNK', key, iterator.toString(), chunk]; | ||
parseCommand(parser: CommandParser, key: RedisArgument, iterator: number, chunk: RedisArgument) { | ||
parser.push('BF.LOADCHUNK'); | ||
parser.pushKey(key); | ||
parser.push(iterator.toString(), chunk); | ||
}, | ||
transformReply: undefined as unknown as () => SimpleStringReply<'OK'> | ||
} as const satisfies Command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; | ||
import { RedisVariadicArgument, pushVariadicArguments } from '@redis/client/dist/lib/commands/generic-transformers'; | ||
import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/generic-transformers'; | ||
import { CommandParser } from '@redis/client/lib/client/parser'; | ||
import { RedisArgument, Command } from '@redis/client/lib/RESP/types'; | ||
import { RedisVariadicArgument } from '@redis/client/lib/commands/generic-transformers'; | ||
import { transformBooleanArrayReply } from '@redis/client/lib/commands/generic-transformers'; | ||
|
||
export default { | ||
FIRST_KEY_INDEX: 1, | ||
IS_READ_ONLY: false, | ||
transformArguments(key: RedisArgument, items: RedisVariadicArgument) { | ||
return pushVariadicArguments(['BF.MADD', key], items); | ||
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) { | ||
parser.push('BF.MADD'); | ||
parser.pushKey(key); | ||
parser.pushVariadic(items); | ||
}, | ||
transformReply: transformBooleanArrayReply | ||
} as const satisfies Command; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { RedisArgument, Command } from '@redis/client/dist/lib/RESP/types'; | ||
import { RedisVariadicArgument, pushVariadicArguments } from '@redis/client/dist/lib/commands/generic-transformers'; | ||
import { transformBooleanArrayReply } from '@redis/client/dist/lib/commands/generic-transformers'; | ||
import { CommandParser } from '@redis/client/lib/client/parser'; | ||
import { RedisArgument, Command } from '@redis/client/lib/RESP/types'; | ||
import { RedisVariadicArgument } from '@redis/client/lib/commands/generic-transformers'; | ||
import { transformBooleanArrayReply } from '@redis/client/lib/commands/generic-transformers'; | ||
|
||
export default { | ||
FIRST_KEY_INDEX: 1, | ||
IS_READ_ONLY: true, | ||
transformArguments(key: RedisArgument, items: RedisVariadicArgument) { | ||
return pushVariadicArguments(['BF.MEXISTS', key], items); | ||
parseCommand(parser: CommandParser, key: RedisArgument, items: RedisVariadicArgument) { | ||
parser.push('BF.MEXISTS'); | ||
parser.pushKey(key); | ||
parser.pushVariadic(items); | ||
}, | ||
transformReply: transformBooleanArrayReply | ||
} as const satisfies Command; |
Oops, something went wrong.