Documentation
¶
Index ¶
- func DFSPath(root *RouteNode, target string) [][]string
- type APIGenBuilder
- func (b *APIGenBuilder) AddRouter(routerFile, groupFunc string) error
- func (b *APIGenBuilder) Build()
- func (b *APIGenBuilder) WithConfig(configFile string) *APIGenBuilder
- func (b *APIGenBuilder) WithHandlerFunc(handlerFile string) *APIGenBuilder
- func (b *APIGenBuilder) WithLogicFunc(logicFile string) *APIGenBuilder
- func (b *APIGenBuilder) WithTypeInfo(typeFile, apiPath string) *APIGenBuilder
- type AddRouterHandler
- type AnnotationData
- type ApiInfo
- type Config
- type FuncInfo
- type GenHandlerFuncHandler
- type GenLogicFuncHandler
- type HandlerChain
- type ParseTypesHandler
- type RouteNode
- type RouterExprInfo
- type TypeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIGenBuilder ¶
type APIGenBuilder struct {
// contains filtered or unexported fields
}
func NewAPIGenBuilder ¶
func NewAPIGenBuilder() *APIGenBuilder
func (*APIGenBuilder) AddRouter ¶
func (b *APIGenBuilder) AddRouter(routerFile, groupFunc string) error
func (*APIGenBuilder) Build ¶
func (b *APIGenBuilder) Build()
func (*APIGenBuilder) WithConfig ¶
func (b *APIGenBuilder) WithConfig(configFile string) *APIGenBuilder
func (*APIGenBuilder) WithHandlerFunc ¶
func (b *APIGenBuilder) WithHandlerFunc(handlerFile string) *APIGenBuilder
func (*APIGenBuilder) WithLogicFunc ¶
func (b *APIGenBuilder) WithLogicFunc(logicFile string) *APIGenBuilder
func (*APIGenBuilder) WithTypeInfo ¶
func (b *APIGenBuilder) WithTypeInfo(typeFile, apiPath string) *APIGenBuilder
type AddRouterHandler ¶
type AddRouterHandler struct {
// contains filtered or unexported fields
}
添加路由的处理者
func (*AddRouterHandler) Handle ¶
func (h *AddRouterHandler) Handle(data *APIGenBuilder)
func (*AddRouterHandler) SetNext ¶
func (h *AddRouterHandler) SetNext(next HandlerChain) HandlerChain
type AnnotationData ¶
type ApiInfo ¶
type ApiInfo struct {
Path string
Method string
HandlerName string
Auth bool
Group string
Summary string
}
func ParseComments ¶
type Config ¶
type Config struct {
ApiPath []string `yaml:"apiPath"`
TypeFile string `yaml:"typeFile"`
Logic struct {
File string `yaml:"file"`
Receiver string `yaml:"receiver"`
} `yaml:"logic"`
Handler struct {
File string `yaml:"file"`
} `yaml:"handler"`
Router struct {
File string `yaml:"file"`
GroupFunc string `yaml:"groupFunc"`
} `yaml:"router"`
}
type GenHandlerFuncHandler ¶
type GenHandlerFuncHandler struct {
// contains filtered or unexported fields
}
生成处理函数的处理者
func (*GenHandlerFuncHandler) Handle ¶
func (h *GenHandlerFuncHandler) Handle(data *APIGenBuilder)
func (*GenHandlerFuncHandler) SetNext ¶
func (h *GenHandlerFuncHandler) SetNext(next HandlerChain) HandlerChain
type GenLogicFuncHandler ¶
type GenLogicFuncHandler struct {
// contains filtered or unexported fields
}
生成逻辑函数的处理者
func (*GenLogicFuncHandler) Handle ¶
func (h *GenLogicFuncHandler) Handle(data *APIGenBuilder)
func (*GenLogicFuncHandler) SetNext ¶
func (h *GenLogicFuncHandler) SetNext(next HandlerChain) HandlerChain
type HandlerChain ¶
type HandlerChain interface {
SetNext(HandlerChain) HandlerChain // 设置下一个处理者
Handle(*APIGenBuilder) // 处理请求
}
定义处理链的接口
type ParseTypesHandler ¶
type ParseTypesHandler struct {
// contains filtered or unexported fields
}
解析类型的处理者
func (*ParseTypesHandler) Handle ¶
func (h *ParseTypesHandler) Handle(data *APIGenBuilder)
func (*ParseTypesHandler) SetNext ¶
func (h *ParseTypesHandler) SetNext(next HandlerChain) HandlerChain
type RouteNode ¶
func BuildRouteTree ¶
type RouterExprInfo ¶
Click to show internal directories.
Click to hide internal directories.