aboutsummaryrefslogtreecommitdiff
path: root/pkg/commands/ping.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/commands/ping.go')
-rw-r--r--pkg/commands/ping.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/commands/ping.go b/pkg/commands/ping.go
new file mode 100644
index 0000000..b56cd20
--- /dev/null
+++ b/pkg/commands/ping.go
@@ -0,0 +1,16 @@
+package commands
+
+import (
+ "errors"
+ "redisClone/pkg/core"
+)
+
+func Ping(args []string, getShard func(k string) *core.Shard) interface{} {
+ if len(args) == 1 {
+ return core.SimpleString("PONG")
+ }
+ if len(args) == 2 {
+ return args[1]
+ }
+ return errors.New("wrong number of arguments for 'PING' command")
+}