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