modules

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Registry

func Registry(m Module)

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 Module

type Module 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
}

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

func Modules

func Modules() []Module

Modules returns all of the registered modules

type Option

type Option func(*Options)

type Options

type Options struct{}

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
basic
v1
internal

Jump to

Keyboard shortcuts

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