mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-16 04:50:45 +08:00
Added plugins folder location in config for the server.
Created get and ser plugin files. Created server function to load plugins. Moved Makefile inside server folder to build and run server.
This commit is contained in:
36
server/plugins/commands/get/get.go
Normal file
36
server/plugins/commands/get/get.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
type Server interface {
|
||||
GetData(key string) interface{}
|
||||
SetData(key string, value interface{})
|
||||
}
|
||||
|
||||
type plugin struct {
|
||||
name string
|
||||
command string
|
||||
description string
|
||||
}
|
||||
|
||||
var Plugin plugin
|
||||
|
||||
func (p *plugin) Name() string {
|
||||
return p.name
|
||||
}
|
||||
|
||||
func (p *plugin) Command() string {
|
||||
return p.command
|
||||
}
|
||||
|
||||
func (p *plugin) Description() string {
|
||||
return p.description
|
||||
}
|
||||
|
||||
func (p *plugin) HandleCommand(tokens []string, server interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
Plugin.name = "GetCommand"
|
||||
Plugin.command = "get"
|
||||
Plugin.description = "Get the value from the specified key"
|
||||
}
|
36
server/plugins/commands/set/set.go
Normal file
36
server/plugins/commands/set/set.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
type Server interface {
|
||||
GetData(key string) interface{}
|
||||
SetData(key string, value interface{})
|
||||
}
|
||||
|
||||
type plugin struct {
|
||||
name string
|
||||
command string
|
||||
description string
|
||||
}
|
||||
|
||||
var Plugin plugin
|
||||
|
||||
func (p *plugin) Name() string {
|
||||
return p.name
|
||||
}
|
||||
|
||||
func (p *plugin) Command() string {
|
||||
return p.command
|
||||
}
|
||||
|
||||
func (p *plugin) Description() string {
|
||||
return p.description
|
||||
}
|
||||
|
||||
func (p *plugin) HandleCommand(tokens []string, server interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
Plugin.name = "SetCommand"
|
||||
Plugin.command = "set"
|
||||
Plugin.description = "Set the value of the specified key"
|
||||
}
|
Reference in New Issue
Block a user