aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-12 14:09:36 +0200
committeralex <[email protected]>2026-07-12 14:09:36 +0200
commitce9d9f8b2183bc0a31bfa40e780ae07182bc7cf8 (patch)
tree73eefd7228bb3ba820c618777495b60a3fb6860f /main.go
parent89b3019a3ab77a3e72720342fc0e5bea996fa4f2 (diff)
downloadredis-clone-command-registry.tar.xz
redis-clone-command-registry.zip
added pubsub command registrycommand-registry
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.go b/main.go
index 9e48eb0..36a41b5 100644
--- a/main.go
+++ b/main.go
@@ -86,7 +86,13 @@ func handleConnection(conn net.Conn) {
command := strings.ToUpper(args[0])
- conn.Write(core.SerializeRESP(commands.DispatchBaseCommand(db,command,args)))
-
+ if cmd , ok := commands.PubSubRegistry[command]; ok {
+ commands.DispatchPubSub(conn, &hub, cmd, args)
+ } else if cmd, ok := commands.BaseRegistry[command]; ok {
+ res := commands.DispatchBaseCommand(db, cmd, args)
+ conn.Write(core.SerializeRESP(res))
+ } else {
+ conn.Write(core.SerializeRESP(fmt.Errorf("ERR unknown command '%s'", command)))
+ }
}
} \ No newline at end of file