Documentation ¶
Index ¶
- func RegisterCommand(commander Commander)
- type BaseCommand
- type Commander
- func GetCommand(name string) Commander
- func NewAuthCommand(callback func(string, ...string) error) Commander
- func NewCreateTableCommand(callback func(string, ...string) error) Commander
- func NewExitCommand(callback func(string, ...string) error) Commander
- func NewGetCommand(callback func(string, ...string) error) Commander
- func NewHelpCommand() Commander
- func NewInsertIntoTableCommand(callback func(string, ...string) error) Commander
- func NewKeysCommand(callback func(string, ...string) error) Commander
- func NewSelectCommand(callback func(string, ...string) error) Commander
- func NewSelectFromTableCommand(callback func(string, ...string) error) Commander
- func NewSetCommand(callback func(string, ...string) error) Commander
- func ParseCommand(input string, sep string) (Commander, []string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCommand ¶
func RegisterCommand(commander Commander)
RegisterCommand appends commander object to collection registered commands for help and other
Types ¶
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand base command fimpemeting commander interface
func NewBaseCommand ¶
func NewBaseCommand(name string, minArgsCount, maxArgsCount int, desc, example string, callback func(string, ...string) error) *BaseCommand
NewBaseCommand constructor for private fields
func (BaseCommand) CallWithArgs ¶
func (bc BaseCommand) CallWithArgs(args ...string) error
CallWithArgs invokes callback associated with command
func (BaseCommand) Name ¶
func (bc BaseCommand) Name() string
Name returns Name associated with command
func (BaseCommand) ShowDescription ¶
func (bc BaseCommand) ShowDescription() string
ShowDescription returns description associated with command
func (BaseCommand) ShowExample ¶
func (bc BaseCommand) ShowExample() string
ShowExample returns example of use this command
func (BaseCommand) ValidateUserInput ¶
func (bc BaseCommand) ValidateUserInput(args []string) error
ValidateUserInput validates args for this command, in base command only checks for count (args including name)
type Commander ¶
type Commander interface { Name() string ShowDescription() string ShowExample() string ValidateUserInput([]string) error CallWithArgs(...string) error }
Commander interface for command from userInput and for server parse
func GetCommand ¶
GetCommand gets command by name or returns nil if not found
func NewAuthCommand ¶
NewAuthCommand constructor standart server commands
func NewCreateTableCommand ¶
NewCreateTableCommand constructor standart server commands
func NewExitCommand ¶
NewExitCommand constructor standart server commands
func NewGetCommand ¶
NewGetCommand constructor standart server commands
func NewHelpCommand ¶
func NewHelpCommand() Commander
NewHelpCommand constructor standart server commands
func NewInsertIntoTableCommand ¶
NewInsertIntoTableCommand constructor standart server commands
func NewKeysCommand ¶
NewSetCommand constructor standart server commands
func NewSelectCommand ¶
NewSelectCommand constructor standart server commands
func NewSelectFromTableCommand ¶
NewSelectFromTableCommand constructor standart server commands
func NewSetCommand ¶
NewSetCommand constructor standart server commands