Skip to main content

store_eval.go

store_eval.go - Overview

This file contains evaluation functions for various commands in DiceDB, handling data storage, manipulation, and retrieval operations.

Detailed Documentation

evalHEXISTS

  • Purpose: Checks if a field exists in a hash stored at a given key.
  • Parameters:
    • args ([]string): An array containing the key and the field to check.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing an integer (1 if the field exists, 0 otherwise) or an error if any.

evalHKEYS

  • Purpose: Retrieves all keys (field names) within a hash.
  • Parameters:
    • args ([]string): An array containing the key of the hash.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing a string array of keys or an error if any. Returns an empty array if the key does not exist.

evalHVALS

  • Purpose: Retrieves all values within a hash.
  • Parameters:
    • args ([]string): An array containing the key of the hash.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing a string array of values or an error if any. Returns an empty array if the key does not exist.

evalGETRANGE

  • Purpose: Returns a substring from the value associated with the key, given start and end indices.
  • Parameters:
    • args ([]string): An array containing the key, start index, and end index.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the substring or an error if any. Returns an empty string if the key is not present or the indices are invalid.

evalZADD

  • Purpose: Adds members with specified scores to a sorted set.
  • Parameters:
    • args ([]string): An array containing the key, flags, scores, and members to add.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the number of added members or an error if any.

parseFlags

  • Purpose: Identifies and parses the flags used in ZADD.
  • Parameters:
    • args ([]string): A slice of strings representing the arguments passed to ZADD.
  • Returns:
    • parsedFlags (map[string]bool): A map of parsed flags.
    • nextIndex (int): The index of the next argument to be processed.

validateFlagsAndArgs

  • Purpose: Validates the combination of flags and arguments provided to ZADD.
  • Parameters:
    • args ([]string): A slice of strings representing the arguments passed to ZADD after the flags.
    • flags (map[string]bool): A map of parsed flags.
  • Returns:
    • error: An error if the flags and arguments are invalid, nil otherwise.

processMembersWithFlags

  • Purpose: Processes the members and scores for ZADD, handling flags such as NX, XX, LT, GT, and CH.
  • Parameters:
    • args ([]string): Arguments containing the score and member pairs.
    • sortedSet (*sortedset.Set): The sorted set to modify.
    • store (*dstore.Store): The data store.
    • key (string): The key for the sorted set.
    • flags (map[string]bool): A map of flags.
  • Returns:
    • *EvalResponse: Returns the number of added or updated members, or an error if any.

shouldSkipMember

  • Purpose: Determines if a member should be skipped based on the given flags and conditions.
  • Parameters:
    • score (float64): The score of the member.
    • currentScore (float64): The current score of the member in the sorted set.
    • exists (bool): Indicates whether the member already exists in the sorted set.
    • flags (map[string]bool): A map of flags.
  • Returns:
    • bool: true if the member should be skipped, false otherwise.

storeUpdatedSet

  • Purpose: Stores the updated sorted set in the store.
  • Parameters:
    • store (*dstore.Store): A pointer to the data store.
    • key (string): The key of the sorted set.
    • sortedSet (*sortedset.Set): A pointer to the sorted set.
  • Returns: void

getOrCreateSortedSet

  • Purpose: Retrieves the sorted set from the store if it exists; otherwise, creates a new sorted set.
  • Parameters:
    • store (*dstore.Store): A pointer to the data store.
    • key (string): The key of the sorted set.
  • Returns:
    • *sortedset.Set: A pointer to the sorted set.
    • error: An error if there's a type mismatch; nil otherwise.

evalZCOUNT

  • Purpose: Counts the number of members in a sorted set within a specified score range.
  • Parameters:
    • args ([]string): An array containing the key, minimum score, and maximum score.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the count of members or an error if any.

evalZRANGE

  • Purpose: Retrieves a range of elements from a sorted set, ordered by score.
  • Parameters:
    • args ([]string): An array containing the key, start index, stop index, and optional WITHSCORES and REV options.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing an array of elements in the specified range or an error if any.

evalZREM

  • Purpose: Removes specified members from a sorted set.
  • Parameters:
    • args ([]string): An array containing the key and the members to remove.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the number of removed members or an error if any.

evalAPPEND

  • Purpose: Appends a value to the value of the key, if it exists.
  • Parameters:
    • args ([]string): An array containing the key and the value to append.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the new length of the value after appending or an error if any.

evalZRANK

  • Purpose: Returns the rank of a member in a sorted set.
  • Parameters:
    • args ([]string): An array containing the key, member, and optional WITHSCORE option.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the rank of the member or an error if any. Returns NIL if the key or member does not exist.

evalZCARD

  • Purpose: Returns the cardinality (number of elements) of the sorted set stored at key.
  • Parameters:
    • args ([]string): An array containing the key.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the cardinality of the sorted set or an error if any.

evalJSONCLEAR

  • Purpose: Clears container values (arrays/objects) and sets numeric values to 0 in a JSON document.
  • Parameters:
    • args ([]string): An array containing the key and optional path.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the number of cleared elements or an error if any.

evalJSONGET

  • Purpose: Retrieves a JSON value stored at the specified key.
  • Parameters:
    • args ([]string): An array containing the key and optional path.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the JSON value or an error if any.

jsonGETHelper

  • Purpose: Helper function used by evalJSONGET and evalJSONMGET to prepare the results.
  • Parameters:
    • store (*dstore.Store): A pointer to the data store.
    • path (string): JSON path.
    • key (string): Key to GET.
  • Returns:
    • *EvalResponse: An EvalResponse containing the JSON value or an error if any.

evalJSONSET

  • Purpose: Stores a JSON value at the specified key.
  • Parameters:
    • args ([]string): An array containing the key, path, and JSON string.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse indicating success or an error if any.

evalJSONINGEST

  • Purpose: Stores a value at a dynamically generated key.
  • Parameters:
    • args ([]string): An array containing key_prefix, path and json value.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse indicating unique identifier if the JSON value is successfully stored.

evalJSONTYPE

  • Purpose: Retrieves the type of a JSON value stored at the specified key.
  • Parameters:
    • args ([]string): An array containing the key and optional path.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the type of the JSON value or an error if any.

evalPFADD

  • Purpose: Adds elements to a HyperLogLog data structure.
  • Parameters:
    • args ([]string): An array containing the key and the elements to add.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse indicating if the cardinality changed or an error if any.

evalJSONSTRLEN

  • Purpose: Report the length of the JSON String at path in key.
  • Parameters:
    • args ([]string): An array containing the key and the JSON string.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the length of the JSON string or an error if any.

evalPFCOUNT

  • Purpose: Estimates the cardinality of a HyperLogLog data structure.
  • Parameters:
    • args ([]string): An array containing the keys of the HyperLogLog data structures.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the estimated cardinality or an error if any.

evalJSONOBJLEN

  • Purpose: Returns the number of keys in the JSON object at path in key.
  • Parameters:
    • args ([]string): An array containing the key and optional path.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the number of keys in the JSON object or an error if any.

evalPTTL

  • Purpose: Returns the time-to-live (TTL) of a key in milliseconds.
  • Parameters:
    • args ([]string): An array containing the key.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the TTL in milliseconds or an error if any.

evalHINCRBY

  • Purpose: Increments the number stored at field in the hash stored at key by increment.
  • Parameters:
    • args ([]string): An array containing the key, field, and increment.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the value after increment or an error if any.

evalHINCRBYFLOAT

  • Purpose: Increments the number stored at field in the hash stored at key by the specified floating point increment.
  • Parameters:
    • args ([]string): An array containing the key, field, and increment.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the value after increment or an error if any.

evalHRANDFIELD

  • Purpose: Returns random fields from a hash.
  • Parameters:
    • args ([]string): An array containing the key, an optional count, and an optional WITHVALUES flag.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the random field(s) and optionally their values, or an error if any.

evalINCRBYFLOAT

  • Purpose: Increments the value of the key by the specified floating point increment.
  • Parameters:
    • args ([]string): An array containing the key and the increment.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the value after increment or an error if any.

incrByFloatCmd

  • Purpose: Core logic for incrementing a float value.
  • Parameters:
    • args ([]string): Arguments to the INCRBYFLOAT command.
    • incr (float64): The amount to increment.
    • store (*dstore.Store): The data store.
  • Returns:
    • *EvalResponse: The new value or an error.

floatValue

  • Purpose: Returns the float64 value for an interface which contains either a string or an int.
  • Parameters:
    • value (interface{})
  • Returns:
    • float64
    • error

evalZPOPMIN

  • Purpose: Removes and returns the member with the lowest score from the sorted set at the specified key.
  • Parameters:
    • args ([]string): An array containing the key and an optional count of elements to pop.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing an array of popped members or an error if any.

evalDUMP

  • Purpose: Serializes the value associated with the key and encodes it.
  • Parameters:
    • args ([]string): An array containing the key to dump.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the serialized value or an error if any.

evalRestore

  • Purpose: Deserializes and restores the value associated with the key.
  • Parameters:
    • args ([]string): An array containing the key, ttl and value to restore.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse indicating the status of the operation or an error if any.

evalHLEN

  • Purpose: Returns the number of fields in a hash.
  • Parameters:
    • args ([]string): An array containing the key of the hash.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the number of fields or an error if any.

evalHSTRLEN

  • Purpose: Returns the length of the string value associated with a field in a hash.
  • Parameters:
    • args ([]string): An array containing the key and field.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the length of the string or an error if any.

evalHSCAN

  • Purpose: Used to incrementally iterate over a hash
  • Parameters:
    • args ([]string): An array containing the key, cursor, and optional MATCH pattern and COUNT value.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns a two element multi-bulk reply, where the first element is a string representing the cursor, and the second element is a multi-bulk with an array of elements.

evalBFRESERVE

  • Purpose: Evaluates the BF.RESERVE command responsible for initializing a new bloom filter and allocation it's relevant parameters based on given inputs.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the status of the operation or an error if any.

evalBFADD

  • Purpose: Evaluates the BF.ADD command responsible for adding an element to a bloom filter. If the filter does not exist, it will create a new one with default parameters.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the status of the operation or an error if any.

evalBFEXISTS

  • Purpose: Evaluates the BF.EXISTS command responsible for checking existence of an element in a bloom filter.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the status of the operation or an error if any.

evalBFINFO

  • Purpose: Evaluates the BF.INFO command responsible for returning the parameters and metadata of an existing bloom filter.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the status of the operation or an error if any.

evalZPOPMAX

  • Purpose: Removes the element with the maximum score from the sorted set.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the removed elements from the sorted set or an error if any.

evalJSONARRTRIM

  • Purpose: Trim an array so that it contains only the specified inclusive range of elements
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns an array of integer replies for each path, the array's new size, or nil, if the matching JSON value is not an array.

evalLPUSH

  • Purpose: Inserts value(s) one by one at the head of of the list
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns list length after command execution

evalRPUSH

  • Purpose: Inserts value(s) one by one at the tail of of the list
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns list length after command execution

evalLPOP

  • Purpose: Pops the element at the head of the list and returns it
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns the element at the head of the list

evalRPOP

  • Purpose: Pops the element at the tail of the list and returns it
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns the element at the tail of the list

evalLLEN

  • Purpose: Returns the number of elements in the list
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns the length of the list

evalJSONARRAPPEND

  • Purpose: Appends the value(s) provided in the args to the given array path in the JSON object saved at key in arguments.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns the new length of the array at path.

evalJSONARRLEN

  • Purpose: Return the length of the JSON array at path in key
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns an array of integer replies, an integer for each matching value, each is the array's length, or nil, if the matching value is not an array.

popElementAndUpdateArray

  • Purpose: Removes an element at the given index
  • Parameters:
    • arr ([]any): The array to modify
    • index (string): the string that tells us what index we are meant to pop
  • Returns:
    • popElem (any) : Popped element
    • updatedArray ([]any): Updated array
    • err (error): potential error

evalJSONARRPOP

  • Purpose: Remove the last element from an array
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns the value that was popped from array

evalJSONARRINSERT

  • Purpose: Insert the json values into the array at path before the index (shifts to the right)
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns an array of integer replies for each path, the array's new size, or nil.

evalJSONOBJKEYS

  • Purpose: Retrieves the keys of a JSON object stored at path specified.
  • Parameters:
    • args ([]string): An array containing the key and optional path.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns a list of keys from the object at the specified path or an error if the path is invalid.

evalJSONRESP

  • Purpose: Converts JSON data into a RESP (REdis Serialization Protocol) format.
  • Parameters:
    • args ([]string): An array containing the key and an optional JSON path.
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Contains the RESP formatted JSON data or an error if any.

parseJSONStructure

  • Purpose: Recursively parses JSON data and converts it into a RESP (REdis Serialization Protocol) format.
  • Parameters:
    • jsonData (interface{}) : Generic data
    • nested (bool): a flag to indicate if the called function is nested
  • Returns:
    • resp ([]any): Returns RESP format.

evalJSONDebug

  • Purpose: Reports value's memory usage in bytes
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Contains memory usage in bytes, errors if subcommand is invalid

evalJSONDebugHelp

  • Purpose: Implements HELP subcommand for evalJSONDebug
  • Parameters: None
  • Returns:
    • *EvalResponse: Contains memory helpText

evalJSONDebugMemory

  • Purpose: Implements MEMORY subcommand for evalJSONDebug
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Contains memory usage in bytes for a key and optional path.

calculateSizeInBytes

  • Purpose: Calculate the memory size in bytes
  • Parameters:
    • value (interface{}) : Generic data
  • Returns:
    • int: Size of the value in bytes.

insertInHashMap

  • Purpose: helper function to insert key value in hashmap associated with the given hash
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • numKeys (int64): the number of keys
    • error: potential error

evalHSET

  • Purpose: sets the specified fields to their respective values in a hashmap stored at key
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns number of keys

evalHMSET

  • Purpose: sets the specified fields to their respective values in a hashmap stored at key
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns an OK if success

evalHMGET

  • Purpose: returns an array of values associated with the given fields, in the same order as they are requested.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns an array of values

evalHGET

  • Purpose: Gets value for a particular key inside the hashmap
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns the value in the hashmap

evalHGETALL

  • Purpose: Returns list of keys and values from hashmap
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns a list of keys and values from hashmap

evalHSETNX

  • Purpose: Sets the value of a hash field only if the field does not exist
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns a value depending if the field exists

evalHDEL

  • Purpose: Deletes field from hashmap
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns the number of fields that were removed from the hash.

evalSADD

  • Purpose: Adds one or more members to a set.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns an integer which represents the number of members that were added to the set, not including the members that were already present

evalSREM

  • Purpose: Removes one or more members from a set
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns the number of members that are removed from set

evalSCARD

  • Purpose: SCARD returns the number of elements of the set stored at key
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns the number of element in a set

evalSMEMBERS

  • Purpose: returns all the members of a set
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns all the members in a Set

evalLRANGE

  • Purpose: returns the specified elements of the list stored at key.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: A list of elements in the specified range, or an empty array if the key doesn't exist.

evalLINSERT

  • Purpose: inserts the element at a key before / after the pivot element.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: The list length (integer) after a successful insert operation, 0 when the key doesn't exist, -1 when the pivot wasn't found.

evalSETBIT

  • Purpose: Set the bit at a offset to a given value
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns bit value that was stored at the bit before overwriting

evalGETBIT

  • Purpose: Gets the bit at a offset to a given value
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns bit value that was stored at the bit

evalBITCOUNT

  • Purpose: Count set bits in a string
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: The number of bits set to 1

bitfieldEvalGeneric

  • Purpose: Generic method for both BITFIELD and BITFIELD_RO.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
    • isReadOnly (bool): command can safely be used in read-only replicas
  • Returns:
    • *EvalResponse: The result of the command

evalBITFIELD

  • Purpose: Evaluates BITFIELD operations on a key store string, int or bytearray types
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: The result of the command

evalBITFIELDRO

  • Purpose: Read-only variant of the BITFIELD command. It is like the original BITFIELD but only accepts GET subcommand and can safely be used in read-only replicas.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: The result of the command

evalGetObject

  • Purpose: Retrieves the internal object representation.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse containing the internal object

evalJSONSTRAPPEND

  • Purpose: Appends a string value to the JSON string value at the specified path
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns the new length of the string at the specified path if successful.

evalJSONTOGGLE

  • Purpose: Toggles boolean
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: An EvalResponse representing toggled value

evalJSONFORGET

  • Purpose: removes the field specified by the given JSONPath from the JSON document stored under the provided key.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: Returns an integer reply specified as the number of paths deleted (0 or more)

evalJSONDEL

  • Purpose: deletes a value specified by the given JSON path from the store.
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns an integer indicating the number of paths deleted (0 or more).

incrMultValue

  • Purpose: Returns the new value after incrementing or multiplying the existing value
  • Parameters:
    • value (any)
    • multiplier (interface{})
    • operation (jsonOperation)
  • Returns:
    • newVal (interface{})
    • resultString (string)
    • isModified (bool)

evalJSONNUMMULTBY

  • Purpose: multiplies the JSON fields matching the specified JSON path at the specified key
  • Parameters:
    • args ([]string): Arguments for command
    • store (*dstore.Store): A pointer to the data store.
  • Returns:
    • *EvalResponse: returns bulk string reply specified as a stringified updated values for each path

`evalCOPY