cmd_echo.go
Filename: cmd_echo.go
- Overview
This file defines the ECHO
command for the DiceDB system. The ECHO
command simply returns the message that was passed to it as an argument.
-
Detailed Documentation
cECHO
- Purpose: Defines the metadata for the
ECHO
command. - Type:
*CommandMeta
- Fields:
Name
: The name of the command ("ECHO").Syntax
: The syntax of the command ("ECHO message").HelpShort
: A short description of the command.HelpLong
: A longer description of the command.Examples
: Examples of how to use the command.Eval
: TheevalECHO
function to pre-evaluate the command.Execute
: TheexecuteECHO
function to execute the command.
init()
- Purpose: Registers the
ECHO
command with theCommandRegistry
. - Parameters: None
- Returns: None
evalECHO(c *Cmd, s *dstore.Store) (*CmdRes, error)
- Purpose: Evaluates the
ECHO
command and constructs the response. - Parameters:
c
: A pointer to theCmd
struct representing the command.s
: A pointer to thedstore.Store
struct representing the data store.
- Returns:
*CmdRes
: A pointer to theCmdRes
struct containing the response.error
: An error if the number of arguments is incorrect.
type Cmd struct {
C *Command
}
type CmdRes struct {
R *wire.Response
}executeECHO(c *Cmd, sm *shardmanager.ShardManager) (*CmdRes, error)
- Purpose: Executes the
ECHO
command within a shard. - Parameters:
c
: A pointer to theCmd
struct representing the command.sm
: A pointer to theshardmanager.ShardManager
struct.
- Returns:
*CmdRes
: A pointer to theCmdRes
struct containing the response.error
: An error if one occurs during evaluation.
- Purpose: Defines the metadata for the
-
Code Examples
None
-
Getting Started Relevance