Documentation ¶
Index ¶
- type Router
- func (r *Router) Error(code int, msg string) rterr.RouterError
- func (r *Router) GetRoute(name string) *routes.Route
- func (r *Router) HandlePath(path string)
- func (r *Router) Match(path string) (*routes.Route, vars.Vars, bool)
- func (r *Router) OnError(cb func(err error))
- func (r *Router) Redirect(path string)
- func (r *Router) RedirectNamed(name string, varMap vars.Vars)
- func (r *Router) Register(name, path string, callable func(v vars.Vars, u *url.URL)) *routes.Route
- func (r *Router) SkipTrailingSlash()
- func (r *Router) String() string
- func (r *Router) Throw(code int)
- func (r *Router) Use(middleware func(vars.Vars, *url.URL, *routes.Route, rterr.ErrorThrower) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is the main router struct.
func (*Router) Error ¶
func (r *Router) Error(code int, msg string) rterr.RouterError
Throw an error in the router with a message.
func (*Router) GetRoute ¶
Get a route by name. If it does not directly exist, it will search in the subroutes.
func (*Router) RedirectNamed ¶
Redirect to a route by name.
func (*Router) SkipTrailingSlash ¶
func (r *Router) SkipTrailingSlash()
SkipTrailingSlash will skip the trailing slash in the path.
Click to show internal directories.
Click to hide internal directories.