Documentation ¶
Index ¶
- Constants
- func Default404(ctx *Context) (string, error)
- func UtilsExistsInSlice(s []string, findValue string) bool
- func UtilsGetContentType(contentType string, reqUrl string) string
- func UtilsToBool(value interface{}) bool
- func UtilsToInt(value interface{}) int
- func UtilsToString(value interface{}) string
- type AppContext
- type Context
- func (ctx *Context) Get(key string) []string
- func (ctx *Context) GetCookie(cookieName string) string
- func (ctx *Context) Plugin(pluginName string) (interface{}, error)
- func (ctx *Context) Redirect(target string)
- func (ctx *Context) Set(key string, value ...string)
- func (ctx *Context) SetCookie(cookieName string, cookieValue string, options map[string]interface{})
- func (ctx *Context) SetPlugin(pluginName string, pluginInstance interface{})
- type ContextPlugin
- type Handler
- type MW
- type MWWrapper
- type Method
- type MiddleWareManager
- type Next
- type Request
- type Response
- type RouteItem
- type RouteRegister
- type Server
- func (s *Server) Close() error
- func (s *Server) Get(path string, handler Handler) *Server
- func (s *Server) Handle(path string, handler Handler, methods ...Method) *Server
- func (s *Server) Post(path string, handler Handler) *Server
- func (s *Server) Start(port string, protocol ...string)
- func (s *Server) Use(mw MWWrapper) *Server
Constants ¶
View Source
const ( ProtocolHttp string = "http" ProtocolHttps string = "https" )
Variables ¶
This section is empty.
Functions ¶
func Default404 ¶
func UtilsExistsInSlice ¶
func UtilsGetContentType ¶
func UtilsToBool ¶
func UtilsToBool(value interface{}) bool
func UtilsToInt ¶
func UtilsToInt(value interface{}) int
func UtilsToString ¶
func UtilsToString(value interface{}) string
Types ¶
type AppContext ¶
type AppContext struct {
// contains filtered or unexported fields
}
func (*AppContext) GetPlugin ¶
func (app *AppContext) GetPlugin(pluginName string) (interface{}, error)
func (*AppContext) SetPlugin ¶
func (app *AppContext) SetPlugin(pluginName string, pluginClient interface{})
type Context ¶
type Context struct { Req Request Res Response Status int // response status Body []byte // contains filtered or unexported fields }
type ContextPlugin ¶
type ContextPlugin struct{}
func (*ContextPlugin) GetContextInstance ¶
func (ctxPlugin *ContextPlugin) GetContextInstance(ctx *Context) interface{}
type MWWrapper ¶
type MWWrapper = func(ctx *AppContext) MW
type MiddleWareManager ¶
type MiddleWareManager struct {
// contains filtered or unexported fields
}
func (*MiddleWareManager) Exec ¶
func (mw *MiddleWareManager) Exec(ctx *Context, handler Handler) (string, error)
func (*MiddleWareManager) Use ¶
func (mw *MiddleWareManager) Use(newMw MW)
type RouteItem ¶
type RouteItem struct { Path string Level int PurePath string MatchReg *regexp.Regexp Register []RouteRegister // 多个method }
func GetRouteItem ¶
type RouteRegister ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.