mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-12 03:10:04 +08:00
Implemented LoadModules method to load external modules at runtime.
Implemented UnloadModules method to remove modules at runtime. Implemented ListModules method to list the current loaded modules. Implemented "MODULE LOAD", "MODULE UNLOAD", and "MODULE LIST" commands.
This commit is contained in:
@@ -231,6 +231,8 @@ func (server *EchoVault) RewriteAOF() (string, error) {
|
||||
//
|
||||
// "command <command> already exists" - If a command with the same command name as the passed command already exists.
|
||||
func (server *EchoVault) AddCommand(command CommandOptions) error {
|
||||
server.commandsRWMut.Lock()
|
||||
defer server.commandsRWMut.Unlock()
|
||||
// Check if command already exists
|
||||
for _, c := range server.commands {
|
||||
if strings.EqualFold(c.Command, command.Command) {
|
||||
@@ -398,6 +400,9 @@ func (server *EchoVault) ExecuteCommand(command ...string) ([]byte, error) {
|
||||
//
|
||||
// `command` - ...string.
|
||||
func (server *EchoVault) RemoveCommand(command ...string) {
|
||||
server.commandsRWMut.Lock()
|
||||
defer server.commandsRWMut.Unlock()
|
||||
|
||||
switch len(command) {
|
||||
case 1:
|
||||
// Remove command
|
||||
|
Reference in New Issue
Block a user