Documentation ¶
Index ¶
- Constants
- type ActionDescriptor
- type ActionExecutorContext
- type ActionFilterChain
- type ActionFilterContext
- type ActionMethodExecutor
- type ApiController
- func (c *ApiController) Fail(msg string) ApiResult
- func (c *ApiController) GetName() string
- func (c *ApiController) OK(data interface{}) ApiResult
- func (c *ApiController) SetViewEngine(viewEngine view.IViewEngine)
- func (c *ApiController) View(name string, data interface{}) actionresult.IActionResult
- type ApiResult
- type ControllerBuilder
- func (builder *ControllerBuilder) AddController(controllerCtor interface{})
- func (builder *ControllerBuilder) AddFilter(pattern string, actionFilter IActionFilter)
- func (builder *ControllerBuilder) AddViews(option *view.Option)
- func (builder *ControllerBuilder) AddViewsByConfig()
- func (builder *ControllerBuilder) GetControllerDescriptorByName(name string) ControllerDescriptor
- func (builder *ControllerBuilder) GetControllerDescriptorList() []ControllerDescriptor
- func (builder *ControllerBuilder) GetMvcOptions() *Options
- func (builder *ControllerBuilder) GetRouterHandler() *RouterHandler
- func (builder *ControllerBuilder) SetConfiguration(configuration abstractions.IConfiguration)
- func (builder *ControllerBuilder) SetViewEngine(viewEngine view.IViewEngine)
- func (builder *ControllerBuilder) SetupOptions(configOption func(options *Options))
- type ControllerDescriptor
- type IActionFilter
- type IController
- type Options
- type RequestBody
- type RouteTemplate
- type RouterHandler
- type RouterHandlerResponse
Constants ¶
const (
DefaultMvcTemplate = "v1/{controller}/{action}"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionDescriptor ¶
type ActionDescriptor struct { ActionName string ActionMethod string MethodInfo reflectx.MethodInfo }
type ActionExecutorContext ¶
type ActionExecutorContext struct { ControllerName string ActionName string Controller IController ActionDescriptor ActionDescriptor Context *context.HttpContext }
type ActionFilterChain ¶
type ActionFilterChain struct {
// contains filtered or unexported fields
}
ActionFilter Chain
func NewActionFilterChain ¶
func NewActionFilterChain(pattern string, filter IActionFilter) ActionFilterChain
New ActionFilter Chain
func (ActionFilterChain) GetFilter ¶
func (chain ActionFilterChain) GetFilter() IActionFilter
Get ActionFilter of Chain
func (ActionFilterChain) MatchFilter ¶
func (chain ActionFilterChain) MatchFilter(want string) IActionFilter
// Match path for pattern to ActionFilter
func (ActionFilterChain) MatchPath ¶
func (chain ActionFilterChain) MatchPath(want string) bool
Match path for pattern
func (ActionFilterChain) SetFilter ¶
func (chain ActionFilterChain) SetFilter(filter IActionFilter)
Set ActionFilter to Chain
type ActionFilterContext ¶
type ActionFilterContext struct { ActionExecutorContext Result interface{} }
ActionFilter context
type ActionMethodExecutor ¶
type ActionMethodExecutor struct { }
func NewActionMethodExecutor ¶
func NewActionMethodExecutor() ActionMethodExecutor
func (ActionMethodExecutor) Execute ¶
func (actionExecutor ActionMethodExecutor) Execute(ctx *ActionExecutorContext) interface{}
type ApiController ¶
type ApiController struct {
// contains filtered or unexported fields
}
func (*ApiController) Fail ¶
func (c *ApiController) Fail(msg string) ApiResult
func (*ApiController) GetName ¶
func (c *ApiController) GetName() string
func (*ApiController) OK ¶
func (c *ApiController) OK(data interface{}) ApiResult
func (*ApiController) SetViewEngine ¶
func (c *ApiController) SetViewEngine(viewEngine view.IViewEngine)
func (*ApiController) View ¶
func (c *ApiController) View(name string, data interface{}) actionresult.IActionResult
type ControllerBuilder ¶
type ControllerBuilder struct {
// contains filtered or unexported fields
}
ControllerBuilder: controller builder
func NewControllerBuilder ¶
func NewControllerBuilder() *ControllerBuilder
NewControllerBuilder new controller builder
func (*ControllerBuilder) AddController ¶
func (builder *ControllerBuilder) AddController(controllerCtor interface{})
AddController add controller (ctor) to ioc.
func (*ControllerBuilder) AddFilter ¶
func (builder *ControllerBuilder) AddFilter(pattern string, actionFilter IActionFilter)
add filter to mvc
func (*ControllerBuilder) AddViews ¶
func (builder *ControllerBuilder) AddViews(option *view.Option)
AddViews add views to mvc
func (*ControllerBuilder) AddViewsByConfig ¶
func (builder *ControllerBuilder) AddViewsByConfig()
AddViewsByConfig add views by config
func (*ControllerBuilder) GetControllerDescriptorByName ¶
func (builder *ControllerBuilder) GetControllerDescriptorByName(name string) ControllerDescriptor
GetControllerDescriptorByName get controller descriptor by controller name
func (*ControllerBuilder) GetControllerDescriptorList ¶
func (builder *ControllerBuilder) GetControllerDescriptorList() []ControllerDescriptor
GetControllerDescriptorList is get controller descriptor array
func (*ControllerBuilder) GetMvcOptions ¶
func (builder *ControllerBuilder) GetMvcOptions() *Options
GetMvcOptions get mvc options
func (*ControllerBuilder) GetRouterHandler ¶
func (builder *ControllerBuilder) GetRouterHandler() *RouterHandler
GetRouterHandler is get mvc router handler.
func (*ControllerBuilder) SetConfiguration ¶
func (builder *ControllerBuilder) SetConfiguration(configuration abstractions.IConfiguration)
SetConfiguration set configuration
func (*ControllerBuilder) SetViewEngine ¶
func (builder *ControllerBuilder) SetViewEngine(viewEngine view.IViewEngine)
SetViewEngine set view engine
func (*ControllerBuilder) SetupOptions ¶
func (builder *ControllerBuilder) SetupOptions(configOption func(options *Options))
SetupOptions , setup mvc builder options
type ControllerDescriptor ¶
type ControllerDescriptor struct { ControllerName string ControllerType interface{} // ctor func of controller // contains filtered or unexported fields }
ControllerDescriptor
func NewControllerDescriptor ¶
func NewControllerDescriptor(name string, controllerType reflect.Type, controllerCtor interface{}) ControllerDescriptor
NewControllerDescriptor create new controller descriptor
func (ControllerDescriptor) GetActionDescriptorByName ¶
func (controllerDescriptor ControllerDescriptor) GetActionDescriptorByName(actionName string) (ActionDescriptor, bool)
GetActionDescriptorByName get action descriptor by name
func (ControllerDescriptor) GetActionDescriptors ¶
func (controllerDescriptor ControllerDescriptor) GetActionDescriptors() []ActionDescriptor
GetActionDescriptors get action descriptor list
type IActionFilter ¶
type IActionFilter interface { OnActionExecuting(context ActionFilterContext) bool OnActionExecuted(context ActionFilterContext) }
type IController ¶
type IController interface { GetName() string SetViewEngine(viewEngine view.IViewEngine) }
func ActivateController ¶
func ActivateController(serviceProvider dependencyinjection.IServiceProvider, controllerName string) (IController, error)
type Options ¶
type Options struct { Template *RouteTemplate ViewOption *view.Option }
type RequestBody ¶
type RequestBody struct { }
type RouteTemplate ¶
type RouteTemplate struct { Template string TemplateSplits []string ControllerName string ActionName string // contains filtered or unexported fields }
func NewRouteTemplate ¶
func NewRouteTemplate(temp string) *RouteTemplate
func (*RouteTemplate) GetActionIndex ¶
func (template *RouteTemplate) GetActionIndex() int
func (*RouteTemplate) GetControllerIndex ¶
func (template *RouteTemplate) GetControllerIndex() int
func (*RouteTemplate) Match ¶
func (template *RouteTemplate) Match(pathComponents []string) bool
type RouterHandler ¶
type RouterHandler struct { ControllerFilters []ActionFilterChain ControllerDescriptors map[string]ControllerDescriptor Options *Options ViewEngine view.IViewEngine }
func NewMvcRouterHandler ¶
func NewMvcRouterHandler() *RouterHandler
func (*RouterHandler) Invoke ¶
func (handler *RouterHandler) Invoke(ctx *context.HttpContext, pathComponents []string) func(ctx *context.HttpContext)
func (RouterHandler) MatchFilters ¶
func (handler RouterHandler) MatchFilters(ctx *context.HttpContext) []IActionFilter
type RouterHandlerResponse ¶
type RouterHandlerResponse struct {
Result interface{}
}
func (*RouterHandlerResponse) Callback ¶
func (response *RouterHandlerResponse) Callback(ctx *context.HttpContext)
Source Files ¶
- action_descriptor.go
- action_executor_context.go
- action_filter.go
- action_filter_chain.go
- action_method_executor.go
- api_controller.go
- api_result.go
- controller_activator.go
- controller_builder.go
- controller_descriptor.go
- options.go
- request_body.go
- route_template.go
- router_handler.go
- router_handler_response.go