plugins

package
v0.0.0-...-6811493 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(m Plugin)

Types

type Handler

type Handler struct {
	Func   func(w http.ResponseWriter, r *http.Request)
	Method []string
	Hld    http.Handler
}

func (Handler) IsFunc

func (h Handler) IsFunc() bool

type Option

type Option func(*Options)

type Options

type Options struct{}

type Plugin

type Plugin interface {
	// Name of module
	Name() string

	// Path returns the root path of module
	Path() string

	// Init initialize the module
	Init(*cli.Context) error

	// Handlers returns http handler of this module
	Handlers() map[string]*Handler

	// Global Flags
	Flags() []cli.Flag

	// Commands are the Sub-commands
	Commands(...Option) []cli.Command
}

Plugin is the biggest unit of web component. a component is a webapp which will be registered on root path by Name function

func Plugins

func Plugins() []Plugin

Plugins returns all of the registered modules

type Rsp

type Rsp struct {
	Code    uint        `json:"code,omitempty"`
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
	Error   interface{} `json:"error,omitempty"`
}

Rsp is the struct of http api response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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