Documentation ¶
Index ¶
- Constants
- type ApiCRUDHandler
- type GroupHandler
- type ParamRoute
- type RouteHandler
- type Router
- func (r *Router) BindController(name string, controller interface{})
- func (r *Router) BindControllers(controllers map[string]interface{})
- func (r *Router) CRUD(path string, handler ApiCRUDHandler, middleware ...string)
- func (r *Router) Delete(path string, handler interface{}) *RoutesHolder
- func (r *Router) Dispatch(req contract.RequestContract) contract.ResponseContract
- func (r *Router) Get(path string, handler interface{}) *RoutesHolder
- func (r *Router) Group(g GroupHandler, prefix string, middleware ...string)
- func (r *Router) HandleDelete(path string, handler RouteHandler) *RoutesHolder
- func (r *Router) HandleGet(path string, handler RouteHandler) *RoutesHolder
- func (r *Router) HandlePatch(path string, handler RouteHandler) *RoutesHolder
- func (r *Router) HandlePost(path string, handler RouteHandler) *RoutesHolder
- func (r *Router) HandlePut(path string, handler RouteHandler) *RoutesHolder
- func (r *Router) Match(req contract.RequestContract) *ParamRoute
- func (r *Router) Patch(path string, handler interface{}) *RoutesHolder
- func (r *Router) Post(path string, handler interface{}) *RoutesHolder
- func (r *Router) Put(path string, handler interface{}) *RoutesHolder
- func (r *Router) Register(method int, path string, handler RouteHandler) *RoutesHolder
- func (r *Router) RegisterAction(method int, path string, handler interface{}) *RoutesHolder
- type RoutesHolder
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiCRUDHandler ¶
type ApiCRUDHandler interface { Index(request contract.RequestContract) json.Marshaler Show(request contract.RequestContract, id int64) json.Marshaler Store(request contract.RequestContract) contract.ResponseContract Update(request contract.RequestContract, id int64) contract.ResponseContract Delete(request contract.RequestContract, id int64) contract.ResponseContract }
type GroupHandler ¶
type GroupHandler func(r *Router)
type ParamRoute ¶
type ParamRoute struct {
// contains filtered or unexported fields
}
ParamRoute isParam route node
func (*ParamRoute) IsValid ¶
func (p *ParamRoute) IsValid() bool
func (*ParamRoute) Middleware ¶
func (p *ParamRoute) Middleware() []string
func (*ParamRoute) Partials ¶
func (p *ParamRoute) Partials() []pathPartial
Partials partials of route path
func (*ParamRoute) SetMiddleware ¶
func (p *ParamRoute) SetMiddleware(middleware []string)
type RouteHandler ¶
type RouteHandler func(r contract.RequestContract) contract.ResponseContract
RouteHandler normal route handler
func NewRouteHandlerFromHttp ¶
func NewRouteHandlerFromHttp(h http.Handler) RouteHandler
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router app router
func NewRouter ¶
func NewRouter(app *kernel.Application) *Router
func (*Router) BindController ¶
BindController bind single controller
func (*Router) BindControllers ¶
BindControllers bind controllers
func (*Router) CRUD ¶
func (r *Router) CRUD(path string, handler ApiCRUDHandler, middleware ...string)
CRUD register simple crud routes
func (*Router) Delete ¶
func (r *Router) Delete(path string, handler interface{}) *RoutesHolder
func (*Router) Dispatch ¶
func (r *Router) Dispatch(req contract.RequestContract) contract.ResponseContract
func (*Router) Get ¶
func (r *Router) Get(path string, handler interface{}) *RoutesHolder
Get get method router
func (*Router) HandleDelete ¶
func (r *Router) HandleDelete(path string, handler RouteHandler) *RoutesHolder
func (*Router) HandleGet ¶
func (r *Router) HandleGet(path string, handler RouteHandler) *RoutesHolder
HandleGet get method with route handler
func (*Router) HandlePatch ¶
func (r *Router) HandlePatch(path string, handler RouteHandler) *RoutesHolder
func (*Router) HandlePost ¶
func (r *Router) HandlePost(path string, handler RouteHandler) *RoutesHolder
func (*Router) HandlePut ¶
func (r *Router) HandlePut(path string, handler RouteHandler) *RoutesHolder
func (*Router) Match ¶
func (r *Router) Match(req contract.RequestContract) *ParamRoute
func (*Router) Patch ¶
func (r *Router) Patch(path string, handler interface{}) *RoutesHolder
func (*Router) Post ¶
func (r *Router) Post(path string, handler interface{}) *RoutesHolder
func (*Router) Put ¶
func (r *Router) Put(path string, handler interface{}) *RoutesHolder
func (*Router) Register ¶
func (r *Router) Register(method int, path string, handler RouteHandler) *RoutesHolder
Register register route
func (*Router) RegisterAction ¶
func (r *Router) RegisterAction(method int, path string, handler interface{}) *RoutesHolder
RegisterAction register route with giving handler
'handler' can be string(eg: "home@Index",), RouteHandler or any func returns string,RequestContract,[]byte or JsonAble
type RoutesHolder ¶
type RoutesHolder struct {
// contains filtered or unexported fields
}
func (*RoutesHolder) Middleware ¶
func (rh *RoutesHolder) Middleware(middleware ...string) *RoutesHolder
func (*RoutesHolder) Prefix ¶
func (rh *RoutesHolder) Prefix(prefix string) *RoutesHolder
Click to show internal directories.
Click to hide internal directories.