Documentation
¶
Index ¶
- Constants
- Variables
- func AddCmdRouter(use, short string, action CmdHandlerFunc, args ...ICmdArg)
- func AddHttpRouter(url, method string, action HttpHandlerFunc, h HttpInterface)
- func AddTaskRouter(spec string, action TaskHandlerFunc)
- func GetAppName() string
- func GetLang() string
- func GetTranslator(lang ...string) ut.Translator
- func Hostname() string
- func IsEnvDev() bool
- func IsEnvProd() bool
- func RestartApp() error
- func SetHttpNoRouter(action HttpHandlerFunc)
- type App
- type AppConfig
- type Cmd
- type CmdArg
- type CmdBoolArg
- type CmdDurationArg
- type CmdFloat64Arg
- type CmdHandlerFunc
- type CmdInt64Arg
- type CmdIntArg
- type CmdIntSliceArg
- type CmdRouter
- type CmdStringArg
- type CmdStringSliceArg
- type Ctx
- type Err
- type HttpHandlerFunc
- type HttpInterface
- type HttpRouter
- type ICmdArg
- type ResponseBody
- type TaskHandlerFunc
- type TaskRouter
Constants ¶
View Source
const CtxParamsKey = "__PARAMS__"
Variables ¶
View Source
var ( // You can replace yago Err variable in your application,eg. yago.ErrParam = Err("4000=Param err") OK = Err("0") E = Err("1=") // custom error 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") )
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 ...ICmdArg)
func AddHttpRouter ¶
func AddHttpRouter(url, method string, action HttpHandlerFunc, h HttpInterface)
func AddTaskRouter ¶
func AddTaskRouter(spec string, action TaskHandlerFunc)
func GetAppName ¶ added in v1.4.0
func GetAppName() string
func GetTranslator ¶ added in v1.3.0
func GetTranslator(lang ...string) ut.Translator
func RestartApp ¶ added in v1.1.8
func RestartApp() error
func SetHttpNoRouter ¶ added in v1.2.9
func SetHttpNoRouter(action HttpHandlerFunc)
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
// http cors 跨域配置
HttpCorsAllowAllOrigins bool
HttpCorsAllowOrigins []string
HttpCorsAllowMethods []string
HttpCorsAllowHeaders []string
HttpCorsExposeHeaders []string
HttpCorsAllowCredentials bool
HttpCorsMaxAge time.Duration
// http gzip 压缩
HttpGzipOn bool
HttpGzipLevel int
// http pprof
HttpPprof bool
// http biz log
HttpBizLogOn bool
// 开启task服务
TaskEnable bool
// task路由配置
TaskRouters []*TaskRouter
// rpc
RpcEnable bool
// contains filtered or unexported fields
}
type Cmd ¶
func (*Cmd) LoadCmdRouter ¶
func (c *Cmd) LoadCmdRouter()
type CmdArg ¶
type CmdArg = CmdStringArg
type CmdBoolArg ¶ added in v1.2.6
func (CmdBoolArg) SetFlag ¶ added in v1.2.6
func (c CmdBoolArg) SetFlag(cmd *cobra.Command)
type CmdDurationArg ¶ added in v1.2.6
type CmdDurationArg struct {
Name string
Shorthand string
Usage string
Required bool
Value time.Duration
}
func (CmdDurationArg) SetFlag ¶ added in v1.2.6
func (c CmdDurationArg) SetFlag(cmd *cobra.Command)
type CmdFloat64Arg ¶ added in v1.2.6
func (CmdFloat64Arg) SetFlag ¶ added in v1.2.6
func (c CmdFloat64Arg) SetFlag(cmd *cobra.Command)
type CmdInt64Arg ¶ added in v1.2.6
func (CmdInt64Arg) SetFlag ¶ added in v1.2.6
func (c CmdInt64Arg) SetFlag(cmd *cobra.Command)
type CmdIntSliceArg ¶ added in v1.2.6
func (CmdIntSliceArg) SetFlag ¶ added in v1.2.6
func (c CmdIntSliceArg) SetFlag(cmd *cobra.Command)
type CmdRouter ¶
type CmdRouter struct {
Use string
Short string
Action CmdHandlerFunc
Args []ICmdArg
}
type CmdStringArg ¶ added in v1.2.6
func (CmdStringArg) SetFlag ¶ added in v1.2.6
func (c CmdStringArg) SetFlag(cmd *cobra.Command)
type CmdStringSliceArg ¶ added in v1.2.6
type CmdStringSliceArg struct {
Name string
Shorthand string
Usage string
Required bool
Value []string
}
func (CmdStringSliceArg) SetFlag ¶ added in v1.2.6
func (c CmdStringSliceArg) SetFlag(cmd *cobra.Command)
type Ctx ¶
func (*Ctx) GetFileContent ¶ added in v1.4.0
func (*Ctx) GetResponse ¶ added in v1.1.9
func (c *Ctx) GetResponse() (*ResponseBody, bool)
func (*Ctx) SetDataOrErr ¶
type Err ¶
type Err string
type HttpInterface ¶
type HttpRouter ¶
type HttpRouter struct {
Url string
Method string
Action HttpHandlerFunc
// contains filtered or unexported fields
}
type ResponseBody ¶
type TaskRouter ¶
type TaskRouter struct {
Spec string
Action TaskHandlerFunc
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
base
|
|
|
coms
|
|
|
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.


