index.d.ts 895 B

12345678910111213141516171819202122232425262728293031323334
  1. /// <reference types="node" />
  2. /**
  3. * Redis command list
  4. *
  5. * All commands are lowercased.
  6. */
  7. export declare const list: string[];
  8. /**
  9. * Check if the command exists
  10. */
  11. export declare function exists(commandName: string, options?: {
  12. caseInsensitive?: boolean;
  13. }): boolean;
  14. /**
  15. * Check if the command has the flag
  16. *
  17. * Some of possible flags: readonly, noscript, loading
  18. */
  19. export declare function hasFlag(commandName: string, flag: string, options?: {
  20. nameCaseInsensitive?: boolean;
  21. }): boolean;
  22. /**
  23. * Get indexes of keys in the command arguments
  24. *
  25. * @example
  26. * ```javascript
  27. * getKeyIndexes('set', ['key', 'value']) // [0]
  28. * getKeyIndexes('mget', ['key1', 'key2']) // [0, 1]
  29. * ```
  30. */
  31. export declare function getKeyIndexes(commandName: string, args: (string | Buffer | number)[], options?: {
  32. parseExternalKey?: boolean;
  33. nameCaseInsensitive?: boolean;
  34. }): number[];