Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ReJSON

Hierarchy

  • Module
    • ReJSON

Index

Constructors

  • new ReJSON(clusterNodes: ClusterNode[], moduleOptions?: RedisModuleOptions, clusterOptions?: ClusterOptions): ReJSON
  • new ReJSON(redisOptions: RedisOptions, moduleOptions?: RedisModuleOptions): ReJSON
  • Initializing the module object

    Parameters

    • clusterNodes: ClusterNode[]

      The nodes of the cluster

    • Optional moduleOptions: RedisModuleOptions

      The additional module options

    • Optional clusterOptions: ClusterOptions

      The options of the clusters

    Returns ReJSON

  • Initializing the module object

    Parameters

    • redisOptions: RedisOptions

      The options of the redis database

    • Optional moduleOptions: RedisModuleOptions

      The additional module options

    Returns ReJSON

Properties

cluster: Cluster
clusterNodes: ClusterNode[]
clusterOptions: ClusterOptions
isHandleError: boolean
name: string
redis: Redis
redisOptions: RedisOptions
rejsonCommander: RejsonCommander = ...
returnRawResponse: boolean
showDebugLogs: boolean

Methods

  • arrappend(key: string, items: string[], path?: string): Promise<number>
  • Appending string to JSON key array value

    Parameters

    • key: string

      The name of the key

    • items: string[]

      The items to append to an existing JSON array

    • Optional path: string

      The path of the key

    Returns Promise<number>

    Integer, specifically the array's new size.

  • arrindex(key: string, scalar: string, path?: string): Promise<number>
  • Retrieving JSON key array item by index

    Parameters

    • key: string

      The name of the key

    • scalar: string

      The scalar to filter out a JSON key

    • Optional path: string

      The path of the key

    Returns Promise<number>

    Integer, specifically the position of the scalar value in the array, or -1 if unfound.

  • arrinsert(key: string, index: number, json: string, path?: string): Promise<number>
  • Inserting item into JSON key array

    Parameters

    • key: string

      The name of the key

    • index: number

      The index to insert the JSON into the array

    • json: string

      The JSON string to insert into the array

    • Optional path: string

      The path of the key

    Returns Promise<number>

    Integer, specifically the array's new size.

  • arrlen(key: string, path?: string): Promise<number>
  • Retrieving the length of a JSON key array

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<number>

    Integer, specifically the array's length.

  • arrpop(key: string, index: number, path?: string): Promise<string>
  • Poping an array item by index

    Parameters

    • key: string

      The name of the key

    • index: number

      The index of the array item to pop

    • Optional path: string

      The path of the key

    Returns Promise<string>

    Bulk String, specifically the popped JSON value.

  • arrtrim(key: string, start: number, end: number, path?: string): Promise<string>
  • Triming an array by index range

    Parameters

    • key: string

      The name of the key

    • start: number

      The starting index of the trim

    • end: number

      The ending index of the trim

    • Optional path: string

      The path of the key

    Returns Promise<string>

    Integer, specifically the array's new size.

  • clear(key: string, path?: string): Promise<number>
  • Clearing a JSON key

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key defaults to root if not provided. Non-existing keys and paths are ignored. Deleting an object's root is equivalent to deleting the key from Redis.

    Returns Promise<number>

    The number of paths deleted (0 or 1).

  • connect(): Promise<void>
  • Connecting to the Redis database with the module

    Returns Promise<void>

  • debug(subcommand: "HELP" | "MEMORY", key?: string, path?: string): Promise<number | string[]>
  • Executing debug command

    Parameters

    • subcommand: "HELP" | "MEMORY"

      The subcommand of the debug command

    • Optional key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<number | string[]>

    MEMORY returns an integer, specifically the size in bytes of the value HELP returns an array, specifically with the help message

  • del(key: string, path?: string): Promise<number>
  • Deleting a JSON key

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key defaults to root if not provided. Non-existing keys and paths are ignored. Deleting an object's root is equivalent to deleting the key from Redis.

    Returns Promise<number>

    The number of paths deleted (0 or 1).

  • disconnect(): Promise<void>
  • Disconnecting from the Redis database with the module

    Returns Promise<void>

  • forget(key: string, path?: string): Promise<number>
  • An alias of delCommand

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<number>

    The number of paths deleted (0 or 1).

  • Retrieving a JSON key

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    • Optional parameters: ReJSONGetParameters

      Additional parameters to arrange the returned values

    Returns Promise<string>

    The value at path in JSON serialized form.

  • handleError(error: string): any
  • Handling a error

    Parameters

    • error: string

      The message of the error

    Returns any

  • handleResponse(response: any): any
  • Simpilizing the response of the Module command

    Parameters

    • response: any

      The array response from the module

    Returns any

  • isOnlyTwoDimensionalArray(array: any[]): boolean
  • Check if array is fully two dimensional. Only items in the array are arrays.

    Parameters

    • array: any[]

      The potential two dimensional array

    Returns boolean

  • mget(keys: string[], path?: string): Promise<string[]>
  • Retrieving values from multiple keys

    Parameters

    • keys: string[]

      A list of keys

    • Optional path: string

      The path of the keys

    Returns Promise<string[]>

    The values at path from multiple key's. Non-existing keys and non-existing paths are reported as null.

  • numincrby(key: string, number: number, path?: string): Promise<string>
  • Increasing JSON key value by number

    Parameters

    • key: string

      The name of the key

    • number: number

      The number to increase by

    • Optional path: string

      The path of the key

    Returns Promise<string>

    Bulk String, specifically the stringified new value.

  • nummultby(key: string, number: number, path?: string): Promise<string>
  • Multiplying JSON key value by number

    Parameters

    • key: string

      The name of the key

    • number: number

      The number to multiply by

    • Optional path: string

      The path of the key

    Returns Promise<string>

    Bulk String, specifically the stringified new value.

  • objkeys(key: string, path?: string): Promise<string[]>
  • Retrieving an array of JSON keys

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<string[]>

    Array, specifically the key names in the object as Bulk Strings.

  • objlen(key: string, path?: string): Promise<number>
  • Retrieving the length of a JSON

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<number>

    Integer, specifically the number of keys in the object.

  • paramToString(paramValue: string): string
  • Formatting given param value to string

    Parameters

    • paramValue: string

      The given param value

    Returns string

    A param value converted to string

  • reduceArrayDimension(array: any[][]): any[]
  • Reducing an array by one level. i.e. from two dimensional to 1 dimensional.

    Parameters

    • array: any[][]

      The potentional two dimensional array

    Returns any[]

  • resp(key: string, path?: string): Promise<string[]>
  • Retrieving a JSON key value in RESP protocol

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<string[]>

    Array, specifically the JSON's RESP form as detailed.

  • sendCommand(data: CommandData): Promise<any>
  • Running a Redis command

    Parameters

    • data: CommandData

      The command data of a command to send. Consists of command and args.

    Returns Promise<any>

  • set(key: string, path: string, json: string, condition?: "NX" | "XX"): Promise<"OK">
  • Setting a new JSON key

    Parameters

    • key: string

      The name of the key

    • path: string

      The path of the key

    • json: string

      The JSON string of the key i.e. '{"x": 4}'

    • Optional condition: "NX" | "XX"

      Optional. The condition to set the JSON in.

    Returns Promise<"OK">

    Simple String OK if executed correctly, or Null Bulk if the specified NX or XX conditions were not met.

  • strappend(key: string, string: string, path?: string): Promise<string>
  • Appending string to JSON key string value

    Parameters

    • key: string

      The name of the key

    • string: string

      The string to append to key value

    • Optional path: string

      The path of the key

    Returns Promise<string>

    Integer, specifically the string's new length.

  • strlen(key: string, path?: string): Promise<number>
  • Retrieving the length of a JSON key value

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<number>

    Integer, specifically the string's length.

  • toggle(key: string, path?: string): Promise<boolean>
  • Toggling a JSON key

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key defaults to root if not provided. Non-existing keys and paths are ignored. Deleting an object's root is equivalent to deleting the key from Redis.

    Returns Promise<boolean>

    The value of the path after the toggle.

  • type(key: string, path?: string): Promise<string>
  • Retrieving the type of a JSON key

    Parameters

    • key: string

      The name of the key

    • Optional path: string

      The path of the key

    Returns Promise<string>

    Simple String, specifically the type of value.

Generated using TypeDoc