Documentation ¶
Index ¶
- Constants
- Variables
- func AddCmdRouter(use, short string, action CmdHandlerFunc, args ...CmdArg)
- func AddHttpRouter(url, method string, action HttpHandlerFunc, h HttpInterface)
- func AddTaskRouter(spec string, action TaskHandlerFunc)
- func Hostname() string
- func IsEnvDev() bool
- func IsEnvProd() bool
- func RestartApp() error
- type App
- type AppConfig
- type Cmd
- type CmdArg
- type CmdHandlerFunc
- type CmdRouter
- type Components
- type Ctx
- func (c *Ctx) RequestBool(key string, def ...bool) bool
- func (c *Ctx) RequestFileContent(key string) ([]byte, error)
- func (c *Ctx) RequestFloat64(key string, def ...float64) (float64, error)
- func (c *Ctx) RequestInt(key string, def ...int) (int, error)
- func (c *Ctx) RequestInt64(key string, def ...int64) (int64, error)
- func (c *Ctx) RequestSliceInt(key string, def ...int) []int
- func (c *Ctx) RequestSliceInt64(key string, def ...int64) []int64
- func (c *Ctx) RequestSliceString(key string, def ...string) []string
- func (c *Ctx) RequestString(key string, def ...string) string
- func (c *Ctx) SetData(data interface{})
- func (c *Ctx) SetDataOrErr(data interface{}, err Err)
- func (c *Ctx) SetError(err Err, msgEx ...string)
- func (c *Ctx) Validate() error
- type Err
- type HttpHandlerFunc
- type HttpInterface
- type HttpRouter
- type ResponseBody
- type TaskHandlerFunc
- type TaskRouter
Constants ¶
View Source
const ( // 1-1000 系统错误, 1000 - 9999 业务公共错误, 10000 - .... 业务错误 OK = Err("0") E = Err("1=") // 自定义错误信息 ErrParam = Err("2=") ErrSign = Err("3=sign failed") ErrAuth = Err("4=auth failed") ErrForbidden = Err("5=forbidden") ErrNotLogin = Err("6=user not login") ErrSystem = Err("7=system error") ErrOperate = Err("8=") ErrUnknown = Err("9=unknown error") )
Variables ¶
View Source
var CmdRouterMap = make(map[string]*CmdRouter)
View Source
var Component = new(Components)
View Source
var GlobalCloseChan = make(chan int)
View Source
var HttpRouterMap = make(map[string]*HttpRouter)
View Source
var RpcServer *grpc.Server
View Source
var TaskCloseChan = make(chan int)
View Source
var TaskRouterList []*TaskRouter
Functions ¶
func AddCmdRouter ¶
func AddCmdRouter(use, short string, action CmdHandlerFunc, args ...CmdArg)
func AddHttpRouter ¶
func AddHttpRouter(url, method string, action HttpHandlerFunc, h HttpInterface)
func AddTaskRouter ¶
func AddTaskRouter(spec string, action TaskHandlerFunc)
func RestartApp ¶ added in v1.1.8
func RestartApp() error
Types ¶
type App ¶
type App struct { // 是否开启debug模式 DebugMode bool // http run mode HttpRunMode string // 开启http服务 HttpEnable bool // http路由配置 HttpRouters []*HttpRouter // https 证书配置 HttpSslOn bool HttpCertFile string HttpKeyFile string // http html 模版配置 HttpViewRender bool HttpViewPath string HttpStaticPath string // 开启task服务 TaskEnable bool // task路由配置 TaskRouters []*TaskRouter // rpc RpcEnable bool // contains filtered or unexported fields }
type Cmd ¶
func (*Cmd) LoadCmdRouter ¶
func (c *Cmd) LoadCmdRouter()
type CmdRouter ¶
type CmdRouter struct { Use string Short string Action CmdHandlerFunc Args []CmdArg }
type Components ¶
type Components struct {
// contains filtered or unexported fields
}
func (*Components) Ins ¶
func (c *Components) Ins(key string, f func() interface{}) interface{}
type Ctx ¶
func (*Ctx) RequestFileContent ¶ added in v1.1.4
func (*Ctx) RequestFloat64 ¶
func (*Ctx) RequestSliceString ¶
func (*Ctx) SetDataOrErr ¶
type Err ¶
type Err string
type HttpHandlerFunc ¶
type HttpHandlerFunc func(c *Ctx)
type HttpInterface ¶
type HttpRouter ¶
type HttpRouter struct { Url string Method string Action HttpHandlerFunc // contains filtered or unexported fields }
http
type ResponseBody ¶
type TaskRouter ¶
type TaskRouter struct { Spec string Action TaskHandlerFunc }
Directories ¶
Path | Synopsis |
---|---|
common
|
|
Code generated by yago.
|
Code generated by yago. |
app/modules/home/homerpc/homepb
Package app_homepb is a generated protocol buffer package.
|
Package app_homepb is a generated protocol buffer package. |
app/third/homeapi/homepb
Package app_homepb is a generated protocol buffer package.
|
Package app_homepb is a generated protocol buffer package. |
libs
|
|
Click to show internal directories.
Click to hide internal directories.