Documentation
¶
Index ¶
- func AddAfterHandler(name string, action EzAction)
- func AddBeforeHandler(name string, action EzAction)
- func AddFinisher(name string, action EzAction)
- func AddPreparer(name string, action EzAction)
- func Dispatch(operation *Operation)
- func PublicHandle(handler *EzHandler, operation *Operation)
- func Run()
- type EzAction
- type EzFunc
- type EzHandler
- func (this *EzHandler) Add(weight int, name string, action EzAction) *EzHandler
- func (this *EzHandler) Get(dataName string) interface{}
- func (this *EzHandler) Run(operation *Operation)
- func (this *EzHandler) SAdd(weight int, name string, action EzAction) *EzHandler
- func (this *EzHandler) Set(dataName string, data interface{})
- type Input
- type InputAnyThing
- func (this *InputAnyThing) IsBool(def ...bool) bool
- func (this *InputAnyThing) IsFloat32(def ...float32) float32
- func (this *InputAnyThing) IsFloat64(def ...float64) float64
- func (this *InputAnyThing) IsInt(def ...int) int
- func (this *InputAnyThing) IsInt16(def ...int16) int16
- func (this *InputAnyThing) IsInt32(def ...int32) int32
- func (this *InputAnyThing) IsInt64(def ...int64) int64
- func (this *InputAnyThing) IsInt8(def ...int8) int8
- func (this *InputAnyThing) IsMap() map[string]interface{}
- func (this *InputAnyThing) IsString(def ...string) string
- func (this *InputAnyThing) IsUint(def ...uint) uint
- func (this *InputAnyThing) IsUint16(def ...uint16) uint16
- func (this *InputAnyThing) IsUint32(def ...uint32) uint32
- func (this *InputAnyThing) IsUint64(def ...uint64) uint64
- func (this *InputAnyThing) IsUint8(def ...uint8) uint8
- type JsonOut
- type Operation
- func (this *Operation) CreateContext() context.Context
- func (this *Operation) FillJson(model interface{}) error
- func (this *Operation) Get(key string) *InputAnyThing
- func (this *Operation) GetHeader() http.Header
- func (this *Operation) GetPublic(dataName string) interface{}
- func (this *Operation) Html(data string)
- func (this *Operation) JsonOut(data interface{})
- func (this *Operation) SetHeader(key string, value string)
- func (this *Operation) SetPublic(dataName string, data interface{})
- func (this *Operation) Stop()
- func (this *Operation) StopHandle()
- type Output
- type PublicData
- type RouteHub
- type Router
- type ServerHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAfterHandler ¶
func AddBeforeHandler ¶
func AddFinisher ¶
func AddPreparer ¶
func PublicHandle ¶
Types ¶
type EzHandler ¶
type EzHandler struct {
Matcher string
Router *Router
Action *EzAction
Public map[string]*PublicData //公开数据
ActionSort []string
StatusCode int //允许中断
Actions map[string]map[string]*EzAction
CurAction *EzAction
IsStop bool
}
func NewEzHandler ¶
type Input ¶
type Input struct {
Request *http.Request
Url string
UrlData map[string]string
Json []byte
Form url.Values
}
func GetInputFromRequest ¶
func (*Input) Get ¶
func (this *Input) Get(key string) *InputAnyThing
func (*Input) GetFromGetPost ¶
func (this *Input) GetFromGetPost(key string) *InputAnyThing
func (*Input) GetFromJson ¶
func (this *Input) GetFromJson(key string) *InputAnyThing
func (*Input) GetFromUrl ¶
func (this *Input) GetFromUrl(key string) *InputAnyThing
type InputAnyThing ¶
type InputAnyThing struct {
Receive interface{}
}
func NewInputAnyThing ¶
func NewInputAnyThing(v interface{}) *InputAnyThing
func (*InputAnyThing) IsBool ¶
func (this *InputAnyThing) IsBool(def ...bool) bool
func (*InputAnyThing) IsFloat32 ¶
func (this *InputAnyThing) IsFloat32(def ...float32) float32
func (*InputAnyThing) IsFloat64 ¶
func (this *InputAnyThing) IsFloat64(def ...float64) float64
func (*InputAnyThing) IsInt ¶
func (this *InputAnyThing) IsInt(def ...int) int
func (*InputAnyThing) IsInt16 ¶
func (this *InputAnyThing) IsInt16(def ...int16) int16
func (*InputAnyThing) IsInt32 ¶
func (this *InputAnyThing) IsInt32(def ...int32) int32
func (*InputAnyThing) IsInt64 ¶
func (this *InputAnyThing) IsInt64(def ...int64) int64
func (*InputAnyThing) IsInt8 ¶
func (this *InputAnyThing) IsInt8(def ...int8) int8
func (*InputAnyThing) IsMap ¶
func (this *InputAnyThing) IsMap() map[string]interface{}
func (*InputAnyThing) IsString ¶
func (this *InputAnyThing) IsString(def ...string) string
func (*InputAnyThing) IsUint ¶
func (this *InputAnyThing) IsUint(def ...uint) uint
func (*InputAnyThing) IsUint16 ¶
func (this *InputAnyThing) IsUint16(def ...uint16) uint16
func (*InputAnyThing) IsUint32 ¶
func (this *InputAnyThing) IsUint32(def ...uint32) uint32
func (*InputAnyThing) IsUint64 ¶
func (this *InputAnyThing) IsUint64(def ...uint64) uint64
func (*InputAnyThing) IsUint8 ¶
func (this *InputAnyThing) IsUint8(def ...uint8) uint8
type JsonOut ¶
type JsonOut struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
func NewJsonOut ¶
func NewJsonOut(p ...interface{}) *JsonOut
type Operation ¶
type Operation struct {
//链路key
ChainKey string
//处理数据输入
Input *Input
//处理数据输出
Output *Output
//作为协作模式的数据共享中心
//Coordination Coordination
Handler *EzHandler
//操作计时器
Timer *core.Timer
//Logger
Logger *core.Logger
//是否中止
IsStop bool
}
func GetOperationFromContext ¶
func NewOperation ¶
func NewOperation(resp http.ResponseWriter, req *http.Request) *Operation
func (*Operation) CreateContext ¶
func (*Operation) Get ¶
func (this *Operation) Get(key string) *InputAnyThing
type PublicData ¶
type RouteHub ¶
type RouteHub struct {
//直接匹配的路由
DirectRouter map[string]*EzHandler
//正则匹配的路由
RegxRouter map[string]*EzHandler
//全局前置中间件
Preparer map[string]*EzAction
//全局后置中间件
Finisher map[string]*EzAction
//Handler前置操作,区别于前置操作,这时已经可以获取到route等信息了
BeforeHandler map[string]*EzAction
//Handler后置操作
AfterHandler map[string]*EzAction
}
func GetRouteHub ¶ added in v1.0.2
func GetRouteHub() *RouteHub
func NewRouteHub ¶
func NewRouteHub() *RouteHub
func (*RouteHub) AddDirectRoute ¶
type ServerHandler ¶
func NewServerHandler ¶
func NewServerHandler() *ServerHandler
func (*ServerHandler) ServeHTTP ¶
func (this *ServerHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.