Documentation ¶
Index ¶
- Constants
- Variables
- func Provide(name string, value interface{})
- func Proxy(proxyPtr interface{}, ...)
- func ProxyValue(mapperValue reflect.Value, ...)
- func RegisterGlobalErrorHandleChan(handle *HttpErrorHandle)
- func RegisterGlobalHttpChan(handle *HttpChan)
- func RegisterGlobalResultHandleChan(handle *HttpResultHandle)
- type Controller
- type HttpChan
- type HttpErrorHandle
- type HttpResultHandle
- type MultipartFile
- type ProxyArg
- type TagArg
Constants ¶
View Source
const ContentType = "Content-Type"
Variables ¶
View Source
var Context inject.Graph
View Source
var ControllerTable = sync.Map{}
View Source
var GlobalErrorHandle = func(w http.ResponseWriter, r *http.Request) { err := recover() for _, itemFunc := range GlobalErrorHandleChan { if itemFunc != nil { itemFunc.Func(err, w, r) } } }
全局错误处理器
View Source
var GlobalErrorHandleChan = []*HttpErrorHandle{}
全局错误调用链
View Source
var GlobalHttpChan = []*HttpChan{}
全局http调用链,过滤器,return error 不为nil则不继续执行
View Source
var GlobalResultHandleChan = []*HttpResultHandle{}
Functions ¶
func Proxy ¶
func Proxy(proxyPtr interface{}, buildFunc func(funcField reflect.StructField, field reflect.Value) func(arg ProxyArg) []reflect.Value)
AopProxy 可写入每个函数代理方法.proxyPtr:代理对象指针,buildFunc:构建代理函数
func ProxyValue ¶
func ProxyValue(mapperValue reflect.Value, buildFunc func(funcField reflect.StructField, field reflect.Value) func(arg ProxyArg) []reflect.Value)
AopProxy 可写入每个函数代理方法
func RegisterGlobalErrorHandleChan ¶
func RegisterGlobalErrorHandleChan(handle *HttpErrorHandle)
注册全局错误
func RegisterGlobalResultHandleChan ¶
func RegisterGlobalResultHandleChan(handle *HttpResultHandle)
注册全局错误
Types ¶
type Controller ¶
type Controller struct{}
例如 SendSms(writer http.ResponseWriter, request *http.Request) `path:"/" arg:"w,r" ` 模板 `path:"" arg:"" `
func (*Controller) Init ¶
func (it *Controller) Init(arg interface{}, router *mux.Router)
type HttpErrorHandle ¶
type HttpErrorHandle struct { Func func(err interface{}, w http.ResponseWriter, r *http.Request) Name string }
type HttpResultHandle ¶
type MultipartFile ¶
type MultipartFile struct { multipart.File *multipart.FileHeader Error error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.