import { deserializeScanResponse } from "../util"; import type { CommandOptions } from "./command"; import { Command } from "./command"; import type { ScanCommandOptions } from "./scan"; /** * @see https://redis.io/commands/hscan * @see node_modules/@upstash/redis/docs/commands/hash/hscan.mdx */ export class HScanCommand extends Command< [string, (string | number)[]], [string, (string | number)[]] > { constructor( [key, cursor, cmdOpts]: [key: string, cursor: string | number, cmdOpts?: ScanCommandOptions], opts?: CommandOptions<[string, (string | number)[]], [string, (string | number)[]]> ) { const command: (number | string)[] = ["hscan", key, cursor]; if (typeof cmdOpts?.match === "string") { command.push("match", cmdOpts.match); } if (typeof cmdOpts?.count === "number") { command.push("count", cmdOpts.count); } super(command, { deserialize: deserializeScanResponse, ...opts, }); } }