command

package
v0.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdContext

type CmdContext struct {
	CmdType string
	Args    interface{}
}

上下文

type Command

type Command interface {
	Do(args interface{}) (interface{}, error)
}

命令接口

type CommandHandler

type CommandHandler struct {
	CmdMap map[string]Command
}

命令管理者

func (*CommandHandler) Handle

func (ch *CommandHandler) Handle(ctx *CmdContext) (interface{}, error)

处理命令

func (*CommandHandler) Register

func (ch *CommandHandler) Register(cmdType string, cmd Command)

注册命令

type GetCommand

type GetCommand struct {
}

Get 命令

func (*GetCommand) Do

func (gc *GetCommand) Do(args interface{}) (interface{}, error)

type PostCommand

type PostCommand struct {
}

post 命令

func (*PostCommand) Do

func (pc *PostCommand) Do(args interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL