mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-10-12 19:30:35 +08:00

Created get and ser plugin files. Created server function to load plugins. Moved Makefile inside server folder to build and run server.
37 lines
608 B
Go
37 lines
608 B
Go
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"
|
|
}
|