1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Support the NOVALUES option of HSCAN (#2711)

* Support the NOVALUES option of HSCAN

Issue #2705

The NOVALUES option instructs HSCAN to only return keys, without their
values. This is materialized as a new command, `hScanNoValues`, given
that the return type is different from the usual return type of `hScan`.
Also a new iterator is provided, `hScanNoValuesIterator`, for the same
reason.

* skip hscan novalues test if redis < 7.4

* Also don't test hscan no values iterator < 7.4

---------

Co-authored-by: Shaya Potter <spotter@gmail.com>
This commit is contained in:
Gabriel Erzse
2024-07-14 14:20:30 +03:00
committed by GitHub
parent 5576a0db49
commit 64fca37944
7 changed files with 160 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
import { RedisCommandArgument, RedisCommandArguments } from '.';
import { ScanOptions } from './generic-transformers';
import { HScanRawReply, transformArguments as transformHScanArguments } from './HSCAN';
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './HSCAN';
export function transformArguments(
key: RedisCommandArgument,
cursor: number,
options?: ScanOptions
): RedisCommandArguments {
const args = transformHScanArguments(key, cursor, options);
args.push('NOVALUES');
return args;
}
interface HScanNoValuesReply {
cursor: number;
keys: Array<RedisCommandArgument>;
}
export function transformReply([cursor, rawData]: HScanRawReply): HScanNoValuesReply {
return {
cursor: Number(cursor),
keys: [...rawData]
};
}