Documentation
¶
Index ¶
- Variables
- func AppBaseDir() string
- func AppBinDir() string
- func AppConfDir() string
- func AppDataDir() string
- func AppLogDir() string
- func AppName() string
- func AppParseConf(i interface{}) error
- func AppParseFlags(flagsetName string, i interface{}, flagArgs []string, nonFlagArgs *[]string) error
- func AppRun(app interface{}, args []string) error
- func AppWritePidFile(path string)
- func GinRouteStructMethods(r *gin.Engine, controller interface{})
- func GraceListenAndServe(addr string, handler http.Handler, beforebeginFuncs ...func(add string)) error
Constants ¶
This section is empty.
Variables ¶
View Source
var GraceOptions struct { AutoRestart bool AutoBuild bool }
View Source
var Log *logrus.Logger = nil
provide the default logger
Functions ¶
func AppBaseDir ¶
func AppBaseDir() string
func AppConfDir ¶
func AppConfDir() string
func AppDataDir ¶
func AppDataDir() string
func AppParseFlags ¶
func AppParseFlags(flagsetName string, i interface{}, flagArgs []string, nonFlagArgs *[]string) error
@param i pointer to struct
func AppWritePidFile ¶
func AppWritePidFile(path string)
func GinRouteStructMethods ¶
自动路由到 Struct 的所有方法,如果定义 Test:
type Test struct{
A int
}
func (*Test) Foo(ctx *gin.Context) {
ctx.JSON(200, gin.H{ "message": "pong", })
}
那么
GinRouteStructMethods(r,&Test{})
相当于
t = &Text{}
r.GET( "/test/foo",func(ctx *gin.Context) { t.Foo(ctx)})
r.GET( "/Test/Foo",func(ctx *gin.Context) { t.Foo(ctx)})
r.POST("/test/foo",func(ctx *gin.Context) { t.Foo(ctx)})
r.POST("/Test/Foo",func(ctx *gin.Context) { t.Foo(ctx)})
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.