Documentation
¶
Overview ¶
@Time : 2019-01-19 10:50 @Author : seefan @File : archive.go @Software: microgo
Index ¶
- type Archive
- type HTTPContext
- func (h *HTTPContext) Body() string
- func (h *HTTPContext) Keys() []string
- func (h *HTTPContext) Set(name, value string)
- func (h *HTTPContext) SetForm(forms url.Values)
- func (h *HTTPContext) Slice(name string) []string
- func (h *HTTPContext) String(name string) string
- func (h *HTTPContext) Value(name string) ctx.Value
- type HTTPServer
- func (h *HTTPServer) Header(name, value string)
- func (h *HTTPServer) Register(svc service.Service) *Archive
- func (h *HTTPServer) RegisterAfterWare(svc service.Service, md ...service.Ware)
- func (h *HTTPServer) RegisterBeforeWare(svc service.Service, md ...service.Ware)
- func (h *HTTPServer) SetDocPath(path string)
- func (h *HTTPServer) SetStaticPath(path, url string)
- func (h *HTTPServer) SetTemplatePath(path, ext string, cached ...bool) error
- func (h *HTTPServer) SetWebsocketURL(url string)
- func (h *HTTPServer) Start() (err error)
- func (h *HTTPServer) Stop() error
- type Method
- type MethodInputPutput
- type MethodNoInputOutput
- type MethodOnlyInput
- type MethodOnlyOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶ added in v0.1.1
type Archive struct {
// contains filtered or unexported fields
}
Archive Archive
type HTTPContext ¶
type HTTPContext struct {
Request *http.Request
Response http.ResponseWriter
// contains filtered or unexported fields
}
HTTPContext context
func (*HTTPContext) SetForm ¶ added in v0.1.1
func (h *HTTPContext) SetForm(forms url.Values)
SetForm Set form param
func (*HTTPContext) Slice ¶ added in v0.1.1
func (h *HTTPContext) Slice(name string) []string
Slice get param slice
func (*HTTPContext) String ¶ added in v0.1.1
func (h *HTTPContext) String(name string) string
String get string param
type HTTPServer ¶
type HTTPServer struct {
server.Server
//Debug output debug info
Debug bool
//common prefix
Prefix string
//method context
Context func(*HTTPContext) ctx.Entry
//Marshal format
Marshal func(result *ctx.Result) ([]byte, error)
//result format
Result func(result *ctx.Result) interface{}
//error format
Error func(result *ctx.Result, err error)
//log
RuntimeLog func(err error)
//parse websocket path
WebSocketPath func(string) (string, string)
//parse webscoket message
WebSocketMessage func(string) (map[string]string, error)
// contains filtered or unexported fields
}
HTTPServer for basic function
func NewHTTPServer ¶
func NewHTTPServer(host string, port int) *HTTPServer
NewHTTPServer create new http server
func (*HTTPServer) Header ¶ added in v0.1.1
func (h *HTTPServer) Header(name, value string)
Header Set common header
func (*HTTPServer) Register ¶
func (h *HTTPServer) Register(svc service.Service) *Archive
Register register service
func (*HTTPServer) RegisterAfterWare ¶ added in v0.1.1
func (h *HTTPServer) RegisterAfterWare(svc service.Service, md ...service.Ware)
RegisterAfterWare only register ware
func (*HTTPServer) RegisterBeforeWare ¶ added in v0.1.1
func (h *HTTPServer) RegisterBeforeWare(svc service.Service, md ...service.Ware)
RegisterBeforeWare only register ware
func (*HTTPServer) SetDocPath ¶ added in v0.1.1
func (h *HTTPServer) SetDocPath(path string)
SetDocPath only register ware
func (*HTTPServer) SetStaticPath ¶ added in v0.1.1
func (h *HTTPServer) SetStaticPath(path, url string)
SetStaticPath static files
func (*HTTPServer) SetTemplatePath ¶ added in v0.1.1
func (h *HTTPServer) SetTemplatePath(path, ext string, cached ...bool) error
SetTemplatePath static files
func (*HTTPServer) SetWebsocketURL ¶ added in v0.1.1
func (h *HTTPServer) SetWebsocketURL(url string)
SetWebsocketURL websocket url prefix
type MethodInputPutput ¶ added in v0.1.2
//MethodInputPutput method
type MethodNoInputOutput ¶ added in v0.1.2
type MethodNoInputOutput = func()
//MethodNotInputOutput no input no output
type MethodOnlyInput ¶ added in v0.1.2
//MethodOnlyInput no output
type MethodOnlyOutput ¶ added in v0.1.2
type MethodOnlyOutput = func() interface{}
//MethodOnlyOutput no input
Source Files
¶
Click to show internal directories.
Click to hide internal directories.