Documentation ¶
Index ¶
- Constants
- func AddStartHook(hf ...hookfunc)
- func ClearDir(config recconf.LogConfig)
- func Error(rw http.ResponseWriter, code int, msg string)
- func Forward(method, url, body string) *http.Response
- func HandleFunc(pattern string, hf handleFunc)
- func ListenConfig(configName string)
- func Route(pattern string, c ControllerInterface)
- func Run()
- type App
- type ConfigLoader
- type ControllerInterface
- type ControllerRegister
- type MiddlewareController
- type MiddlewareFunc
- type ResponseWriter
- type RouteInfo
Constants ¶
View Source
const ( LOG_DEBUG = "DEBUG" LOG_INFO = "INFO" LOG_ERROR = "ERROR" LOG_FATAL = "FATAL" LOG_OUTPUT_CONSOLE = "console" )
Variables ¶
This section is empty.
Functions ¶
func AddStartHook ¶
func AddStartHook(hf ...hookfunc)
func HandleFunc ¶
func HandleFunc(pattern string, hf handleFunc)
func ListenConfig ¶
func ListenConfig(configName string)
ListenConfig init a instace of ConfigLoader ConfigLoader will loop load paire config from server when the config version change
func Route ¶
func Route(pattern string, c ControllerInterface)
Types ¶
type App ¶
type App struct { Handlers *ControllerRegister Server *http.Server }
var (
PairecApp *App
)
func (*App) Use ¶
func (app *App) Use(middleware ...MiddlewareFunc)
type ConfigLoader ¶
type ConfigLoader struct {
// contains filtered or unexported fields
}
func NewConfigLoader ¶
func NewConfigLoader(configName string) *ConfigLoader
type ControllerInterface ¶
type ControllerInterface interface {
Process(http.ResponseWriter, *http.Request)
}
type ControllerRegister ¶
type ControllerRegister struct { Middlewares []MiddlewareFunc // contains filtered or unexported fields }
func NewControllerRegister ¶
func NewControllerRegister() *ControllerRegister
func (*ControllerRegister) ApplyMiddlewares ¶
func (c *ControllerRegister) ApplyMiddlewares()
func (*ControllerRegister) GetRoutePath ¶ added in v2.0.5
func (c *ControllerRegister) GetRoutePath() (paths []string)
func (*ControllerRegister) Register ¶
func (c *ControllerRegister) Register(routeInfo *RouteInfo)
func (*ControllerRegister) ServeHTTP ¶
func (c *ControllerRegister) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type MiddlewareController ¶
type MiddlewareController struct { ControllerInterface Middlewares []MiddlewareFunc }
func (MiddlewareController) Process ¶
func (c MiddlewareController) Process(resp http.ResponseWriter, req *http.Request)
type MiddlewareFunc ¶
type MiddlewareFunc func(handler func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)
type ResponseWriter ¶
type ResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter) *ResponseWriter
func (*ResponseWriter) Size ¶
func (w *ResponseWriter) Size() int
func (*ResponseWriter) StatusCode ¶
func (w *ResponseWriter) StatusCode() int
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(statusCode int)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
ha3engine/ha3client
This file is auto-generated, don't edit it.
|
This file is auto-generated, don't edit it. |
middleware
|
|
persist
|
|
pkg
|
|
Click to show internal directories.
Click to hide internal directories.